diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2009-06-15 09:06:43 (GMT) |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2009-06-15 09:31:31 (GMT) |
commit | c411f16870f112c3407c28c22b617f613a82cff4 (patch) | |
tree | 29a1bcd590c8b31af2aab445bfe8a978dc5bf582 /src/3rdparty/webkit/JavaScriptCore/debugger | |
parent | 3d77b56b32a0c53ec0bbfaa07236fedb900ff336 (diff) | |
download | Qt-c411f16870f112c3407c28c22b617f613a82cff4.zip Qt-c411f16870f112c3407c28c22b617f613a82cff4.tar.gz Qt-c411f16870f112c3407c28c22b617f613a82cff4.tar.bz2 |
Updated WebKit from /home/shausman/src/webkit/trunk to qtwebkit-4.6-snapshot-15062009 ( 65232bf00dc494ebfd978f998c88f58d18ecce1e )
Diffstat (limited to 'src/3rdparty/webkit/JavaScriptCore/debugger')
6 files changed, 204 insertions, 7 deletions
diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp index a52a542..7d791e7 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.cpp @@ -23,6 +23,8 @@ #include "Debugger.h" #include "JSGlobalObject.h" +#include "Interpreter.h" +#include "Parser.h" namespace JSC { @@ -51,4 +53,18 @@ void Debugger::detach(JSGlobalObject* globalObject) globalObject->setDebugger(0); } +JSValue evaluateInGlobalCallFrame(const UString& script, JSValue& exception, JSGlobalObject* globalObject) +{ + CallFrame* globalCallFrame = globalObject->globalExec(); + + int errLine; + UString errMsg; + SourceCode source = makeSource(script); + RefPtr<EvalNode> evalNode = globalObject->globalData()->parser->parse<EvalNode>(globalCallFrame, globalObject->debugger(), source, &errLine, &errMsg); + if (!evalNode) + return Error::create(globalCallFrame, SyntaxError, errMsg, errLine, source.provider()->asID(), source.provider()->url()); + + return globalObject->globalData()->interpreter->execute(evalNode.get(), globalCallFrame, globalObject, globalCallFrame->scopeChain(), &exception); +} + } // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h index 6af116f..868ea71 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/Debugger.h @@ -54,6 +54,10 @@ namespace JSC { HashSet<JSGlobalObject*> m_globalObjects; }; + // This method exists only for backwards compatibility with existing + // WebScriptDebugger clients + JSValue evaluateInGlobalCallFrame(const UString&, JSValue& exception, JSGlobalObject*); + } // namespace JSC #endif // Debugger_h diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp new file mode 100644 index 0000000..4b2568f --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.cpp @@ -0,0 +1,103 @@ +/* + * Copyright (C) 2008 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "config.h" +#include "DebuggerActivation.h" + +#include "JSActivation.h" + +namespace JSC { + +DebuggerActivation::DebuggerActivation(JSObject* activation) + : JSObject(DebuggerActivation::createStructure(jsNull())) +{ + ASSERT(activation); + ASSERT(activation->isActivationObject()); + m_activation = static_cast<JSActivation*>(activation); +} + +void DebuggerActivation::mark() +{ + JSObject::mark(); + if (m_activation && !m_activation->marked()) + m_activation->mark(); +} + +UString DebuggerActivation::className() const +{ + return m_activation->className(); +} + +bool DebuggerActivation::getOwnPropertySlot(ExecState* exec, const Identifier& propertyName, PropertySlot& slot) +{ + return m_activation->getOwnPropertySlot(exec, propertyName, slot); +} + +void DebuggerActivation::put(ExecState* exec, const Identifier& propertyName, JSValue value, PutPropertySlot& slot) +{ + m_activation->put(exec, propertyName, value, slot); +} + +void DebuggerActivation::putWithAttributes(ExecState* exec, const Identifier& propertyName, JSValue value, unsigned attributes) +{ + m_activation->putWithAttributes(exec, propertyName, value, attributes); +} + +bool DebuggerActivation::deleteProperty(ExecState* exec, const Identifier& propertyName) +{ + return m_activation->deleteProperty(exec, propertyName); +} + +void DebuggerActivation::getPropertyNames(ExecState* exec, PropertyNameArray& propertyNames) +{ + m_activation->getPropertyNames(exec, propertyNames); +} + +bool DebuggerActivation::getPropertyAttributes(JSC::ExecState* exec, const Identifier& propertyName, unsigned& attributes) const +{ + return m_activation->getPropertyAttributes(exec, propertyName, attributes); +} + +void DebuggerActivation::defineGetter(ExecState* exec, const Identifier& propertyName, JSObject* getterFunction) +{ + m_activation->defineGetter(exec, propertyName, getterFunction); +} + +void DebuggerActivation::defineSetter(ExecState* exec, const Identifier& propertyName, JSObject* setterFunction) +{ + m_activation->defineSetter(exec, propertyName, setterFunction); +} + +JSValue DebuggerActivation::lookupGetter(ExecState* exec, const Identifier& propertyName) +{ + return m_activation->lookupGetter(exec, propertyName); +} + +JSValue DebuggerActivation::lookupSetter(ExecState* exec, const Identifier& propertyName) +{ + return m_activation->lookupSetter(exec, propertyName); +} + +} // namespace JSC diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h new file mode 100644 index 0000000..9e1f9f5 --- /dev/null +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerActivation.h @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2008 Apple Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef DebuggerActivation_h +#define DebuggerActivation_h + +#include "JSObject.h" + +namespace JSC { + + class JSActivation; + + class DebuggerActivation : public JSObject { + public: + DebuggerActivation(JSObject*); + + virtual void mark(); + virtual UString className() const; + virtual bool getOwnPropertySlot(ExecState*, const Identifier& propertyName, PropertySlot&); + virtual void put(ExecState*, const Identifier& propertyName, JSValue, PutPropertySlot&); + virtual void putWithAttributes(ExecState*, const Identifier& propertyName, JSValue, unsigned attributes); + virtual bool deleteProperty(ExecState*, const Identifier& propertyName); + virtual void getPropertyNames(ExecState*, PropertyNameArray&); + virtual bool getPropertyAttributes(ExecState*, const Identifier& propertyName, unsigned& attributes) const; + virtual void defineGetter(ExecState*, const Identifier& propertyName, JSObject* getterFunction); + virtual void defineSetter(ExecState*, const Identifier& propertyName, JSObject* setterFunction); + virtual JSValue lookupGetter(ExecState*, const Identifier& propertyName); + virtual JSValue lookupSetter(ExecState*, const Identifier& propertyName); + + static PassRefPtr<Structure> createStructure(JSValue prototype) + { + return Structure::create(prototype, TypeInfo(ObjectType)); + } + + private: + JSActivation* m_activation; + }; + +} // namespace JSC + +#endif // DebuggerActivation_h diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp index 27b824c..cd8702b 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.cpp @@ -46,6 +46,17 @@ const UString* DebuggerCallFrame::functionName() const return 0; return &function->name(&m_callFrame->globalData()); } + +UString DebuggerCallFrame::calculatedFunctionName() const +{ + if (!m_callFrame->codeBlock()) + return 0; + + JSFunction* function = static_cast<JSFunction*>(m_callFrame->callee()); + if (!function) + return 0; + return function->calculatedDisplayName(&m_callFrame->globalData()); +} DebuggerCallFrame::Type DebuggerCallFrame::type() const { @@ -63,10 +74,10 @@ JSObject* DebuggerCallFrame::thisObject() const return asObject(m_callFrame->thisValue()); } -JSValuePtr DebuggerCallFrame::evaluate(const UString& script, JSValuePtr& exception) const +JSValue DebuggerCallFrame::evaluate(const UString& script, JSValue& exception) const { if (!m_callFrame->codeBlock()) - return noValue(); + return JSValue(); int errLine; UString errMsg; diff --git a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.h b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.h index cdf4965..9d377ef 100644 --- a/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.h +++ b/src/3rdparty/webkit/JavaScriptCore/debugger/DebuggerCallFrame.h @@ -39,11 +39,10 @@ namespace JSC { DebuggerCallFrame(CallFrame* callFrame) : m_callFrame(callFrame) - , m_exception(noValue()) { } - DebuggerCallFrame(CallFrame* callFrame, JSValuePtr exception) + DebuggerCallFrame(CallFrame* callFrame, JSValue exception) : m_callFrame(callFrame) , m_exception(exception) { @@ -52,14 +51,15 @@ namespace JSC { JSGlobalObject* dynamicGlobalObject() const { return m_callFrame->dynamicGlobalObject(); } const ScopeChainNode* scopeChain() const { return m_callFrame->scopeChain(); } const UString* functionName() const; + UString calculatedFunctionName() const; Type type() const; JSObject* thisObject() const; - JSValuePtr evaluate(const UString&, JSValuePtr& exception) const; - JSValuePtr exception() const { return m_exception; } + JSValue evaluate(const UString&, JSValue& exception) const; + JSValue exception() const { return m_exception; } private: CallFrame* m_callFrame; - JSValuePtr m_exception; + JSValue m_exception; }; } // namespace JSC |