Commit 879b0435 authored by kmccullo's avatar kmccullo
Browse files

Reviewed by Adam.

        - This patch does two main things.
        1) It adds pragma warning guards around WebCore includes in WebKit files
        that were previously overlooked.
        2) It implements almost the entireity of WebScriptDebugger.  Only one
        function remains and that implementation is dependent on finishing the
        implementation of WebScriptScope.

        * WebScriptCallFrame.h:
        * WebScriptDebugServer.h:
        * WebScriptDebugger.cpp:
        (WebScriptDebugger::WebScriptDebugger):
        (WebScriptDebugger::sourceParsed):
        (WebScriptDebugger::callEvent):
        (WebScriptDebugger::atStatement):
        (WebScriptDebugger::returnEvent):
        (WebScriptDebugger::exception):
        (WebScriptDebugger::enterFrame):
        (WebScriptDebugger::leaveFrame):
        * WebScriptDebugger.h:



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@27640 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 01d79a9c
2007-11-08 Kevin McCullough <kmccullough@apple.com>
Reviewed by Adam.
- This patch does two main things.
1) It adds pragma warning guards around WebCore includes in WebKit files
that were previously overlooked.
2) It implements almost the entireity of WebScriptDebugger. Only one
function remains and that implementation is dependent on finishing the
implementation of WebScriptScope.
* WebScriptCallFrame.h:
* WebScriptDebugServer.h:
* WebScriptDebugger.cpp:
(WebScriptDebugger::WebScriptDebugger):
(WebScriptDebugger::sourceParsed):
(WebScriptDebugger::callEvent):
(WebScriptDebugger::atStatement):
(WebScriptDebugger::returnEvent):
(WebScriptDebugger::exception):
(WebScriptDebugger::enterFrame):
(WebScriptDebugger::leaveFrame):
* WebScriptDebugger.h:
2007-11-08 Steve Falkenburg <sfalken@apple.com>
 
<rdar://problem/5491463> Wrong dates shown in History menu.
......
......@@ -32,7 +32,9 @@
#include "IWebScriptCallFrame.h"
#include <JavaScriptCore/ExecState.h>
#pragma warning(push, 0)
#include <WebCore/COMPtr.h>
#pragma warning(pop)
class WebScriptCallFrame : public IWebScriptCallFrame {
public:
......
......@@ -30,7 +30,9 @@
#include "IWebScriptDebugListener.h"
#include <wtf/HashSet.h>
#pragma warning(push, 0)
#include <WebCore/COMPtr.h>
#pragma warning(pop)
interface IWebView;
......
......@@ -34,38 +34,45 @@
#include "WebFrame.h"
#include "WebScriptDebugServer.h"
#pragma warning(push, 0)
#include <WebCore/BString.h>
#include <WebCore/kjs_binding.h>
#include <WebCore/kjs_proxy.h>
#include <WebCore/PlatformString.h>
#include <WebCore/COMPtr.h>
#pragma warning(pop)
using namespace WebCore;
using namespace KJS;
WebScriptDebugger::WebScriptDebugger(WebFrame* frame)
: m_frame(frame)
{
ASSERT(m_frame);
if (KJSProxy* proxy = core(m_frame)->scriptProxy())
attach(static_cast<KJS::Interpreter*>(proxy->interpreter()));
KJSProxy* proxy = core(m_frame)->scriptProxy();
if (!proxy)
return;
Interpreter* interp(proxy->interpreter());
attach(interp);
m_frame->webView(&m_webView);
ASSERT(m_webView);
callEvent(interp->globalExec(), -1, -1, 0, List());
}
bool WebScriptDebugger::sourceParsed(KJS::ExecState*, int sourceId, const KJS::UString& sourceURL,
const KJS::UString& source, int startingLineNumber, int errorLine, const KJS::UString& /*errorMsg*/)
bool WebScriptDebugger::sourceParsed(ExecState*, int sourceId, const UString& sourceURL,
const UString& source, int startingLineNumber, int errorLine, const UString& /*errorMsg*/)
{
if (WebScriptDebugServer::listenerCount() <= 0)
return true;
COMPtr<IWebView> webView;
if (FAILED(m_frame->webView(&webView)))
return false;
BString bSource = String(source);
BString bSourceURL = String(sourceURL);
if (errorLine == -1) {
WebScriptDebugServer::sharedWebScriptDebugServer()->didParseSource(webView.get(),
WebScriptDebugServer::sharedWebScriptDebugServer()->didParseSource(m_webView.get(),
bSource,
startingLineNumber,
bSourceURL,
......@@ -75,7 +82,7 @@ bool WebScriptDebugger::sourceParsed(KJS::ExecState*, int sourceId, const KJS::U
// FIXME: the error var should be made with the information in the errorMsg. It is not a simple
// UString to BSTR conversion there is some logic involved that I don't fully understand yet.
BString error(L"An Error Occurred.");
WebScriptDebugServer::sharedWebScriptDebugServer()->failedToParseSource(webView.get(),
WebScriptDebugServer::sharedWebScriptDebugServer()->failedToParseSource(m_webView.get(),
bSource,
startingLineNumber,
bSourceURL,
......@@ -86,3 +93,48 @@ bool WebScriptDebugger::sourceParsed(KJS::ExecState*, int sourceId, const KJS::U
return true;
}
bool WebScriptDebugger::callEvent(ExecState* state, int sourceId, int lineno, JSObject* /*function*/, const List &/*args*/)
{
enterFrame(state);
WebScriptDebugServer::sharedWebScriptDebugServer()->didEnterCallFrame(m_webView.get(), m_topStackFrame.get(), sourceId, lineno, m_frame);
return true;
}
bool WebScriptDebugger::atStatement(ExecState*, int sourceId, int firstLine, int /*lastLine*/)
{
WebScriptDebugServer::sharedWebScriptDebugServer()->willExecuteStatement(m_webView.get(), m_topStackFrame.get(), sourceId, firstLine, m_frame);
return true;
}
bool WebScriptDebugger::returnEvent(ExecState*, int sourceId, int lineno, JSObject* /*function*/)
{
WebScriptDebugServer::sharedWebScriptDebugServer()->willLeaveCallFrame(m_webView.get(), m_topStackFrame.get(), sourceId, lineno, m_frame);
leaveFrame();
return true;
}
bool WebScriptDebugger::exception(ExecState*, int sourceId, int lineno, JSValue* /*exception */)
{
WebScriptDebugServer::sharedWebScriptDebugServer()->exceptionWasRaised(m_webView.get(), m_topStackFrame.get(), sourceId, lineno, m_frame);
return true;
}
void WebScriptDebugger::enterFrame(ExecState*)
{
// FIXME: the implementation of this is dependent on finishing the implementation of WebScriptScope.
}
void WebScriptDebugger::leaveFrame()
{
if (!m_topStackFrame)
return;
COMPtr<IWebScriptCallFrame> caller;
if (FAILED(m_topStackFrame->caller(&caller)))
return;
m_topStackFrame = caller;
}
......@@ -29,12 +29,22 @@
#ifndef WebScriptDebugger_H
#define WebScriptDebugger_H
#include "IWebView.h"
#include "IWebScriptCallFrame.h"
#include <JavaScriptCore/debugger.h>
#pragma warning(push, 0)
#include <WebCore/COMPtr.h>
#pragma warning(pop)
class WebFrame;
interface IWebScriptCallFrame;
namespace KJS {
class ExecState;
class JSObject;
class JSValue;
class List;
}
class WebScriptDebugger : public KJS::Debugger {
......@@ -44,8 +54,18 @@ public:
bool sourceParsed(KJS::ExecState*, int sourceId, const KJS::UString& sourceURL,
const KJS::UString& source, int startingLineNumber, int errorLine, const KJS::UString& errorMsg);
bool callEvent(KJS::ExecState*, int sourceId, int lineno, KJS::JSObject* function, const KJS::List& args);
bool atStatement(KJS::ExecState*, int sourceId, int firstLine, int lastLine);
bool returnEvent(KJS::ExecState*, int sourceId, int lineno, KJS::JSObject* function);
bool exception(KJS::ExecState*, int sourceId, int lineno, KJS::JSValue* exception);
private:
void enterFrame(KJS::ExecState*);
void leaveFrame();
WebFrame* m_frame;
COMPtr<IWebView> m_webView;
COMPtr<IWebScriptCallFrame> m_topStackFrame;
};
#endif
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment