diff options
Diffstat (limited to 'WebKitTools/Drosera/win')
-rw-r--r-- | WebKitTools/Drosera/win/BaseDelegate.h | 313 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/DebuggerClient.cpp | 341 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/DebuggerClient.h | 107 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/DebuggerDocumentPlatform.cpp | 160 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/Drosera.cpp | 392 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/Drosera.h | 70 | ||||
-rwxr-xr-x | WebKitTools/Drosera/win/Drosera.vcproj/Drosera.rc | 196 | ||||
-rwxr-xr-x | WebKitTools/Drosera/win/Drosera.vcproj/Drosera.vcproj | 449 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/DroseraPrefix.cpp | 29 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/DroseraPrefix.h | 58 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/Info.plist | 26 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/ServerConnection.cpp | 368 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/ServerConnection.h | 128 | ||||
-rw-r--r-- | WebKitTools/Drosera/win/resource.h | 47 |
14 files changed, 2684 insertions, 0 deletions
diff --git a/WebKitTools/Drosera/win/BaseDelegate.h b/WebKitTools/Drosera/win/BaseDelegate.h new file mode 100644 index 0000000..6bc2f3f --- /dev/null +++ b/WebKitTools/Drosera/win/BaseDelegate.h @@ -0,0 +1,313 @@ +/* + * Copyright (C) 2006, 2007 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 BaseDelegate_H +#define BaseDelegate_H + +#include <WebKit/WebKit.h> + +struct IDataObject; +struct IPropertyBag; +struct IWebView; +struct IWebFrame; +struct IWebError; +struct IWebURLRequest; +struct IWebOpenPanelResultListener; + +class BaseDelegate : public IWebFrameLoadDelegate, public IWebUIDelegate { +public: + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + /* [in] */ REFIID, + /* [retval][out] */ void**) + { return E_NOTIMPL; }; + + // IWebFrameLoadDelegate + virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame( + /* [in] */ IWebView*, + /* [in] */ IWebFrame*) { return E_NOTIMPL; }; + + virtual HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable( + /* [in] */ IWebView*, + /* [in] */ JSContextRef, + /* [in] */ JSObjectRef) { return E_NOTIMPL; }; + + virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame( + /* [in] */ IWebView*, + /* [in] */ IWebFrame*) { return E_NOTIMPL; }; + + virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame( + /* [in] */ IWebView*, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError( + /* [in] */ IWebView*, + /* [in] */ IWebError*, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame( + /* [in] */ IWebView*, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE didReceiveTitle( + /* [in] */ IWebView*, + /* [in] */ BSTR, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE didReceiveIcon( + /* [in] */ IWebView*, + /* [in] */ OLE_HANDLE, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError( + /* [in] */ IWebView*, + /* [in] */ IWebError*, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame( + /* [in] */ IWebView*, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL( + /* [in] */ IWebView*, + /* [in] */ BSTR, + /* [in] */ double /*delaySeconds*/, + /* [in] */ DATE, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame( + /* [in] */ IWebView*, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE willCloseFrame( + /* [in] */ IWebView*, + /* [in] */ IWebFrame*) { return E_NOTIMPL; } + + // IWebUIDelegate + virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest( + /* [in] */ IWebView*, + /* [in] */ IWebURLRequest*, + /* [retval][out] */ IWebView**) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewShow( + /* [in] */ IWebView*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewClose( + /* [in] */ IWebView*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewFocus( + /* [in] */ IWebView*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewUnfocus( + /* [in] */ IWebView*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewFirstResponder( + /* [in] */ IWebView*, + /* [retval][out] */ OLE_HANDLE*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE makeFirstResponder( + /* [in] */ IWebView*, + /* [in] */ OLE_HANDLE) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE setStatusText( + /* [in] */ IWebView*, + /* [in] */ BSTR) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewStatusText( + /* [in] */ IWebView*, + /* [retval][out] */ BSTR*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewAreToolbarsVisible( + /* [in] */ IWebView*, + /* [retval][out] */ BOOL*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE setToolbarsVisible( + /* [in] */ IWebView*, + /* [in] */ BOOL) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewIsStatusBarVisible( + /* [in] */ IWebView*, + /* [retval][out] */ BOOL*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE setStatusBarVisible( + /* [in] */ IWebView*, + /* [in] */ BOOL) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewIsResizable( + /* [in] */ IWebView*, + /* [retval][out] */ BOOL*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE setResizable( + /* [in] */ IWebView*, + /* [in] */ BOOL) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE setFrame( + /* [in] */ IWebView*, + /* [in] */ RECT*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewFrame( + /* [in] */ IWebView*, + /* [retval][out] */ RECT*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE setContentRect( + /* [in] */ IWebView*, + /* [in] */ RECT*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE webViewContentRect( + /* [in] */ IWebView*, + /* [retval][out] */ RECT*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage( + /* [in] */ IWebView*, + /* [in] */ BSTR) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE runJavaScriptConfirmPanelWithMessage( + /* [in] */ IWebView*, + /* [in] */ BSTR, + /* [retval][out] */ BOOL*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE runJavaScriptTextInputPanelWithPrompt( + /* [in] */ IWebView*, + /* [in] */ BSTR /*message*/, + /* [in] */ BSTR /*defaultText*/, + /* [retval][out] */ BSTR*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE runBeforeUnloadConfirmPanelWithMessage( + /* [in] */ IWebView*, + /* [in] */ BSTR /*message*/, + /* [in] */ IWebFrame* /*initiatedByFrame*/, + /* [retval][out] */ BOOL*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE runOpenPanelForFileButtonWithResultListener( + /* [in] */ IWebView*, + /* [in] */ IWebOpenPanelResultListener*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE mouseDidMoveOverElement( + /* [in] */ IWebView*, + /* [in] */ IPropertyBag*, + /* [in] */ UINT /*modifierFlags*/) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE contextMenuItemsForElement( + /* [in] */ IWebView*, + /* [in] */ IPropertyBag*, + /* [in] */ OLE_HANDLE, + /* [retval][out] */ OLE_HANDLE*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE validateUserInterfaceItem( + /* [in] */ IWebView*, + /* [in] */ UINT, + /* [in] */ BOOL, + /* [retval][out] */ BOOL*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE shouldPerformAction( + /* [in] */ IWebView*, + /* [in] */ UINT /*itemCommandID*/, + /* [in] */ UINT /*sender*/) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE dragDestinationActionMaskForDraggingInfo( + /* [in] */ IWebView*, + /* [in] */ IDataObject*, + /* [retval][out] */ WebDragDestinationAction*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE willPerformDragDestinationAction( + /* [in] */ IWebView*, + /* [in] */ WebDragDestinationAction, + /* [in] */ IDataObject*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE dragSourceActionMaskForPoint( + /* [in] */ IWebView*, + /* [in] */ LPPOINT, + /* [retval][out] */ WebDragSourceAction*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE willPerformDragSourceAction( + /* [in] */ IWebView*, + /* [in] */ WebDragSourceAction, + /* [in] */ LPPOINT, + /* [in] */ IDataObject*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE contextMenuItemSelected( + /* [in] */ IWebView*, + /* [in] */ void* /*item*/, + /* [in] */ IPropertyBag*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE hasCustomMenuImplementation( + /* [retval][out] */ BOOL*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE trackCustomPopupMenu( + /* [in] */ IWebView*, + /* [in] */ OLE_HANDLE, + /* [in] */ LPPOINT) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE measureCustomMenuItem( + /* [in] */ IWebView*, + /* [in] */ void* /*measureItem*/) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE drawCustomMenuItem( + /* [in] */ IWebView*, + /* [in] */ void* /*drawItem*/) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE addCustomMenuDrawingData( + /* [in] */ IWebView*, + /* [in] */ OLE_HANDLE) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE cleanUpCustomMenuDrawingData( + /* [in] */ IWebView*, + /* [in] */ OLE_HANDLE) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE canTakeFocus( + /* [in] */ IWebView*, + /* [in] */ BOOL /*forward*/, + /* [out] */ BOOL*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE takeFocus( + /* [in] */ IWebView*, + /* [in] */ BOOL /*forward*/) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE registerUndoWithTarget( + /* [in] */ IWebUndoTarget*, + /* [in] */ BSTR /*actionName*/, + /* [in] */ IUnknown* /*actionArg*/) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE removeAllActionsWithTarget( + /* [in] */ IWebUndoTarget*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE setActionTitle( + /* [in] */ BSTR) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE undo( void) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE redo( void) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE canUndo( + /* [retval][out] */ BOOL*) { return E_NOTIMPL; } + + virtual HRESULT STDMETHODCALLTYPE canRedo( + /* [retval][out] */ BOOL*) { return E_NOTIMPL; } +}; + +#endif //BaseDelegate_H diff --git a/WebKitTools/Drosera/win/DebuggerClient.cpp b/WebKitTools/Drosera/win/DebuggerClient.cpp new file mode 100644 index 0000000..77b689c --- /dev/null +++ b/WebKitTools/Drosera/win/DebuggerClient.cpp @@ -0,0 +1,341 @@ +/* + * Copyright (C) 2007 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "DebuggerClient.h" + +#include "DebuggerDocument.h" +#include "Drosera.h" +#include "ServerConnection.h" + +#include <WebKit/ForEachCoClass.h> +#include <WebKit/WebKit.h> +#include <JavaScriptCore/JSContextRef.h> + +static LPCTSTR kConsoleTitle = _T("Console"); +static LPCTSTR kConsoleClassName = _T("DroseraConsoleWindowClass"); + +static LRESULT CALLBACK consoleWndProc(HWND, UINT, WPARAM, LPARAM); + +void registerConsoleClass(HINSTANCE hInstance) +{ + static bool haveRegisteredWindowClass = false; + + if (haveRegisteredWindowClass) { + haveRegisteredWindowClass = true; + return; + } + + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = 0; + wcex.lpfnWndProc = consoleWndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = sizeof(DebuggerClient*); + wcex.hInstance = hInstance; + wcex.hIcon = 0; + wcex.hCursor = LoadCursor(0, IDC_ARROW); + wcex.hbrBackground = 0; + wcex.lpszMenuName = 0; + wcex.lpszClassName = kConsoleClassName; + wcex.hIconSm = 0; + + RegisterClassEx(&wcex); +} + +static LRESULT CALLBACK consoleWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0); + DebuggerClient* client = reinterpret_cast<DebuggerClient*>(longPtr); + + switch (message) { + case WM_SIZE: + if (!client) + return 0; + return client->onSize(wParam, lParam); + case WM_PAINT: { + PAINTSTRUCT ps; + BeginPaint(hWnd, &ps); + EndPaint(hWnd, &ps); + break; + } + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + + return 0; +} + +LRESULT DebuggerClient::onSize(WPARAM, LPARAM) +{ + if (!m_webViewPrivate) + return 0; + + RECT clientRect = {0}; + if (!GetClientRect(m_consoleWindow, &clientRect)) + return 0; + + HWND viewWindow; + if (SUCCEEDED(m_webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow)))) + SetWindowPos(viewWindow, 0, clientRect.left, clientRect.top, clientRect.right - clientRect.left, clientRect.bottom - clientRect.top, SWP_NOZORDER); + + return 0; +} + +DebuggerClient::DebuggerClient() + : m_webViewLoaded(false) + , m_debuggerDocument(new DebuggerDocument(new ServerConnection())) + , m_globalContext(0) +{ +} + +DebuggerClient::~DebuggerClient() +{ + if (m_globalContext) + JSGlobalContextRelease(m_globalContext); +} + +// IUnknown ------------------------------ +HRESULT STDMETHODCALLTYPE DebuggerClient::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualGUID(riid, IID_IUnknown)) + *ppvObject = this; + else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate)) + *ppvObject = static_cast<IWebFrameLoadDelegate*>(this); + else if (IsEqualGUID(riid, IID_IWebUIDelegate)) + *ppvObject = static_cast<IWebUIDelegate*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +ULONG STDMETHODCALLTYPE DebuggerClient::AddRef() +{ + // COM ref-counting isn't useful to us because we're in charge of the lifetime of the WebView. + return 1; +} + +ULONG STDMETHODCALLTYPE DebuggerClient::Release() +{ + // COM ref-counting isn't useful to us because we're in charge of the lifetime of the WebView. + return 1; +} + +// IWebFrameLoadDelegate ------------------------------ +HRESULT STDMETHODCALLTYPE DebuggerClient::didFinishLoadForFrame( + /* [in] */ IWebView* webView, + /* [in] */ IWebFrame*) +{ + HRESULT ret = S_OK; + + m_webViewLoaded = true; + + COMPtr<IWebFrame> mainFrame; + ret = webView->mainFrame(&mainFrame); + if (FAILED(ret)) + return ret; + + if (!m_globalContext) { + JSGlobalContextRef context = mainFrame->globalContext(); + if (!context) + return E_FAIL; + + m_globalContext = JSGlobalContextRetain(context); + } + + if (serverConnected()) + m_debuggerDocument->server()->setGlobalContext(m_globalContext); + + return ret; +} + +HRESULT STDMETHODCALLTYPE DebuggerClient::windowScriptObjectAvailable( + /* [in] */ IWebView*, + /* [in] */ JSContextRef context, + /* [in] */ JSObjectRef windowObject) +{ + JSValueRef exception = 0; + if (m_debuggerDocument) + m_debuggerDocument->windowScriptObjectAvailable(context, windowObject, &exception); + + if (exception) + return E_FAIL; + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE DebuggerClient::createWebViewWithRequest( + /* [in] */ IWebView*, + /* [in] */ IWebURLRequest* request, + /* [retval][out] */ IWebView** newWebView) +{ + HRESULT ret = S_OK; + + if (!newWebView) + return E_POINTER; + + *newWebView = 0; + + HINSTANCE instance = Drosera::getInst(); + + registerConsoleClass(instance); + + m_consoleWindow = CreateWindow(kConsoleClassName, kConsoleTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, 500, 350, 0, 0, instance, 0); + + if (!m_consoleWindow) + return HRESULT_FROM_WIN32(GetLastError()); + + SetLastError(0); + SetWindowLongPtr(m_consoleWindow, 0, reinterpret_cast<LONG_PTR>(this)); + ret = HRESULT_FROM_WIN32(GetLastError()); + if (FAILED(ret)) + return ret; + + CLSID clsid = CLSID_NULL; + ret = CLSIDFromProgID(PROGID(WebView), &clsid); + if (FAILED(ret)) + return ret; + + COMPtr<IWebView> view; + ret = CoCreateInstance(clsid, 0, CLSCTX_ALL, IID_IWebView, (void**)&view); + if (FAILED(ret)) + return ret; + + m_webViewPrivate.query(view); + if (!m_webViewPrivate) + return E_FAIL; + + ret = view->setHostWindow(reinterpret_cast<OLE_HANDLE>(m_consoleWindow)); + if (FAILED(ret)) + return ret; + + RECT clientRect = {0}; + GetClientRect(m_consoleWindow, &clientRect); + ret = view->initWithFrame(clientRect, 0, 0); + if (FAILED(ret)) + return ret; + + ret = view->setUIDelegate(this); + if (FAILED(ret)) + return ret; + + ret = view->setFrameLoadDelegate(this); + if (FAILED(ret)) + return ret; + + if (request) { + BOOL requestIsEmpty = FALSE; + ret = request->isEmpty(&requestIsEmpty); + if (FAILED(ret)) + return ret; + + if (!requestIsEmpty) { + COMPtr<IWebFrame> mainFrame; + ret = view->mainFrame(&mainFrame); + if (FAILED(ret)) + return ret; + + ret = mainFrame->loadRequest(request); + if (FAILED(ret)) + return ret; + } + } + + ShowWindow(m_consoleWindow, SW_SHOW); + UpdateWindow(m_consoleWindow); + + *newWebView = view.releaseRef(); + + return S_OK; +} + +// IWebUIDelegate ------------------------------ +HRESULT STDMETHODCALLTYPE DebuggerClient::runJavaScriptAlertPanelWithMessage( // For debugging purposes + /* [in] */ IWebView*, + /* [in] */ BSTR message) +{ +#ifndef NDEBUG + fwprintf(stderr, L"%s\n", message ? message : L""); +#else + (void)message; +#endif + return S_OK; +} + +// Pause & Step ------------------------------- +void DebuggerClient::resume() +{ + DebuggerDocument::callGlobalFunction(m_globalContext, "resume", 0, 0); +} + +void DebuggerClient::pause() +{ + DebuggerDocument::callGlobalFunction(m_globalContext, "pause", 0, 0); +} + +void DebuggerClient::stepInto() +{ + DebuggerDocument::callGlobalFunction(m_globalContext, "stepInto", 0, 0); +} + +void DebuggerClient::stepOver() +{ + DebuggerDocument::callGlobalFunction(m_globalContext, "stepOver", 0, 0); +} + +void DebuggerClient::stepOut() +{ + DebuggerDocument::callGlobalFunction(m_globalContext, "stepOut", 0, 0); +} + +void DebuggerClient::showConsole() +{ + DebuggerDocument::callGlobalFunction(m_globalContext, "showConsoleWindow", 0, 0); +} + +void DebuggerClient::closeCurrentFile() +{ + DebuggerDocument::callGlobalFunction(m_globalContext, "closeCurrentFile", 0, 0); +} + + +// Server Connection Functions ---------------- +bool DebuggerClient::serverConnected() const +{ + return m_debuggerDocument->server()->serverConnected(); +} + +void DebuggerClient::attemptToCreateServerConnection() +{ + m_debuggerDocument->server()->attemptToCreateServerConnection(m_globalContext); +} diff --git a/WebKitTools/Drosera/win/DebuggerClient.h b/WebKitTools/Drosera/win/DebuggerClient.h new file mode 100644 index 0000000..7297615 --- /dev/null +++ b/WebKitTools/Drosera/win/DebuggerClient.h @@ -0,0 +1,107 @@ +/* + * Copyright (C) 2006, 2007 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 DebuggerClient_H +#define DebuggerClient_H + +#include "BaseDelegate.h" + +#include <string> +#include <WebCore/COMPtr.h> +#include <wtf/OwnPtr.h> + +class DebuggerDocument; +interface IWebView; +interface IWebFrame; +interface IWebViewPrivate; + +typedef const struct OpaqueJSContext* JSContextRef; +typedef struct OpaqueJSValue* JSObjectRef; + +class DebuggerClient : public BaseDelegate { +public: + DebuggerClient(); + ~DebuggerClient(); + explicit DebuggerClient(const std::wstring& serverName); + + LRESULT DebuggerClient::onSize(WPARAM, LPARAM); + + // IUnknown + HRESULT STDMETHODCALLTYPE QueryInterface( + /* [in] */ REFIID riid, + /* [retval][out] */ void** ppvObject); + + ULONG STDMETHODCALLTYPE AddRef(); + ULONG STDMETHODCALLTYPE Release(); + + // IWebFrameLoadDelegate + HRESULT STDMETHODCALLTYPE didFinishLoadForFrame( + /* [in] */ IWebView*, + /* [in] */ IWebFrame*); + + HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable( + /* [in] */ IWebView*, + /* [in] */ JSContextRef, + /* [in] */ JSObjectRef); + + // IWebUIDelegate + HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage( + /* [in] */ IWebView*, + /* [in] */ BSTR); + + HRESULT STDMETHODCALLTYPE createWebViewWithRequest( + /* [in] */ IWebView*, + /* [in] */ IWebURLRequest*, + /* [retval][out] */ IWebView**); + + bool webViewLoaded() const { return m_webViewLoaded; } + + // Pause & Step + void resume(); + void pause(); + void stepInto(); + void stepOver(); + void stepOut(); + void showConsole(); + void closeCurrentFile(); + + // Server Connection Functions + bool serverConnected() const; + void attemptToCreateServerConnection(); + +private: + bool m_webViewLoaded; + JSGlobalContextRef m_globalContext; + + HWND m_consoleWindow; + COMPtr<IWebViewPrivate> m_webViewPrivate; + + OwnPtr<DebuggerDocument> m_debuggerDocument; +}; + +#endif //DebuggerClient_H diff --git a/WebKitTools/Drosera/win/DebuggerDocumentPlatform.cpp b/WebKitTools/Drosera/win/DebuggerDocumentPlatform.cpp new file mode 100644 index 0000000..f23daf7 --- /dev/null +++ b/WebKitTools/Drosera/win/DebuggerDocumentPlatform.cpp @@ -0,0 +1,160 @@ +/* + * Copyright (C) 2007 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "DebuggerDocument.h" + +#include "ServerConnection.h" + +#include <JavaScriptCore/JSRetainPtr.h> +#include <JavaScriptCore/JSStringRef.h> +#include <JavaScriptCore/JSStringRefBSTR.h> +#include <WebKit/WebKit.h> + +JSValueRef JSValueRefCreateWithBSTR(JSContextRef context, BSTR string) +{ + JSRetainPtr<JSStringRef> jsString(Adopt, JSStringCreateWithBSTR(string)); + return JSValueMakeString(context, jsString.get()); +} + +// DebuggerDocument platform specific implementations + +void DebuggerDocument::platformPause() +{ + m_server->pause(); +} + +void DebuggerDocument::platformResume() +{ + m_server->resume(); +} + +void DebuggerDocument::platformStepInto() +{ + m_server->stepInto(); +} + +JSValueRef DebuggerDocument::platformEvaluateScript(JSContextRef context, JSStringRef script, int callFrame) +{ + HRESULT ret = S_OK; + + COMPtr<IWebScriptCallFrame> cframe = m_server->getCallerFrame(callFrame); + if (!cframe) + return JSValueMakeUndefined(context); + + // Convert script to BSTR + BSTR scriptBSTR = JSStringCopyBSTR(script); + BSTR value = 0; + ret = cframe->stringByEvaluatingJavaScriptFromString(scriptBSTR, &value); + SysFreeString(scriptBSTR); + if (FAILED(ret)) { + SysFreeString(value); + return JSValueMakeUndefined(context); + } + + JSValueRef returnValue = JSValueRefCreateWithBSTR(context, value); + SysFreeString(value); + return returnValue; + +} + +void DebuggerDocument::getPlatformCurrentFunctionStack(JSContextRef context, Vector<JSValueRef>& currentStack) +{ + COMPtr<IWebScriptCallFrame> frame = m_server->currentFrame(); + while (frame) { + COMPtr<IWebScriptCallFrame> caller; + BSTR function = 0; + if (FAILED(frame->functionName(&function))) + return; + + if (FAILED(frame->caller(&caller))) + return; + + if (!function) { + if (caller) + function = SysAllocString(L"(anonymous function)"); + else + function = SysAllocString(L"(global scope)"); + } + + currentStack.append(JSValueRefCreateWithBSTR(context, function)); + SysFreeString(function); + + frame = caller; + } +} + +void DebuggerDocument::getPlatformLocalScopeVariableNamesForCallFrame(JSContextRef context, int callFrame, Vector<JSValueRef>& variableNames) +{ + COMPtr<IWebScriptCallFrame> cframe = m_server->getCallerFrame(callFrame); + if (!cframe) + return; + + VARIANT var; + VariantInit(&var); + + COMPtr<IEnumVARIANT> localScopeVariableNames; + if (FAILED(cframe->variableNames(&localScopeVariableNames))) + return; + + while (localScopeVariableNames->Next(1, &var, 0) == S_OK) { + ASSERT(V_VT(&var) == VT_BSTR); + BSTR variableName; + + variableName = V_BSTR(&var); + variableNames.append(JSValueRefCreateWithBSTR(context, variableName)); + + SysFreeString(variableName); + VariantClear(&var); + } +} + +JSValueRef DebuggerDocument::platformValueForScopeVariableNamed(JSContextRef context, JSStringRef key, int callFrame) +{ + COMPtr<IWebScriptCallFrame> cframe = m_server->getCallerFrame(callFrame); + if (!cframe) + return JSValueMakeUndefined(context); + + BSTR bstrKey = JSStringCopyBSTR(key); + + BSTR variableValue; + HRESULT hr = cframe->valueForVariable(bstrKey, &variableValue); + SysFreeString(bstrKey); + if (FAILED(hr)) + return JSValueMakeUndefined(context); + + JSValueRef returnValue = JSValueRefCreateWithBSTR(context, variableValue); + SysFreeString(variableValue); + + return returnValue; +} + + +void DebuggerDocument::platformLog(JSStringRef msg) +{ + printf("%S\n", JSStringGetCharactersPtr(msg)); +} diff --git a/WebKitTools/Drosera/win/Drosera.cpp b/WebKitTools/Drosera/win/Drosera.cpp new file mode 100644 index 0000000..820054f --- /dev/null +++ b/WebKitTools/Drosera/win/Drosera.cpp @@ -0,0 +1,392 @@ +/* + * Copyright (C) 2007 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "Drosera.h" + +#include "DebuggerClient.h" +#include "DebuggerDocument.h" +#include "resource.h" +#include "ServerConnection.h" + +#include <JavaScriptCore/JSStringRef.h> +#include <WebKit/ForEachCoClass.h> +#include <WebKit/WebKit.h> +#include <wtf/RetainPtr.h> + +const unsigned MAX_LOADSTRING = 100; + +TCHAR szTitle[MAX_LOADSTRING]; // The title bar text +TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name + +static LPCTSTR s_DroseraPointerProp = TEXT("DroseraPointer"); +static HINSTANCE hInst; + +BSTR cfStringToBSTR(CFStringRef cfstr); + +void registerDroseraClass(HINSTANCE hInstance); +LRESULT CALLBACK droseraWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); +INT_PTR CALLBACK aboutWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam); + +HINSTANCE Drosera::getInst() { return hInst; } +void Drosera::setInst(HINSTANCE in) { hInst = in; } +void launchConsoleWindow(); + +extern "C" __declspec(dllimport) HANDLE* __pioinfo; + +int APIENTRY _tWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + MSG msg; + +#ifndef NDEBUG + launchConsoleWindow(); +#endif + + Drosera drosera; + + HRESULT ret = drosera.init(hInstance, nCmdShow); + if (FAILED(ret)) + return ret; + + HACCEL hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_DROSERA)); + + // Main message loop: + while (GetMessage(&msg, 0, 0, 0)) { + if (!drosera.serverConnected()) + drosera.attemptToCreateServerConnection(); + + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + + return static_cast<int>(msg.wParam); +} + +void launchConsoleWindow() +{ + if (AllocConsole()) { + // MSVCRT exports __pioinfo which is an array of ioinfo handles. the first three are stdout, stdin, and stderr + // the first pointer in the ioinfo object is the kernel handle for the console, so we can simplify the expression + // to just deref the exported symbol, setting it to the newly allocated console handle. + *__pioinfo = GetStdHandle(STD_OUTPUT_HANDLE); + // When an app is created without a console, stdout, stderr and stdin are all invalid handles (i.e. negative) + // Since we've introduced new handles, we can reset their file index - which is the index into the ioinfo array. + // This hooks up the standard cruntime APIS to the new console, allowing a functional output. As for input YMMV. + stdout->_file = 0; + stderr->_file = 0; + } +} + +////////////////// Setup Windows Specific Interface ////////////////// + +void registerDroseraClass(HINSTANCE hInstance) +{ + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = ::droseraWndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = sizeof(Drosera*); + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_DROSERA)); + wcex.hCursor = LoadCursor(0, IDC_ARROW); + wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1); + wcex.lpszMenuName = MAKEINTRESOURCE(IDC_DROSERA); + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); + + RegisterClassEx(&wcex); +} + +//Processes messages for the main window. +LRESULT CALLBACK droseraWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + PAINTSTRUCT ps; + HDC hdc; + + LONG_PTR longPtr = GetWindowLongPtr(hWnd, 0); + Drosera* drosera = reinterpret_cast<Drosera*>(longPtr); + + switch (message) { + case WM_COMMAND: + return drosera->handleCommand(hWnd, message, wParam, lParam); + break; + case WM_SIZE: + if (!drosera) + return 0; + return drosera->webViewLoaded() ? drosera->onSize(wParam, lParam) : 0; + case WM_PAINT: + hdc = BeginPaint(hWnd, &ps); + EndPaint(hWnd, &ps); + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + + return 0; +} + +LRESULT CALLBACK Drosera::handleCommand(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId = LOWORD(wParam); + switch (wmId) { + case ID_DEBUG_CONTINUE: + m_debuggerClient->resume(); + break; + case ID_DEBUG_PAUSE: + m_debuggerClient->pause(); + break; + case ID_DEBUG_STEPINTO: + m_debuggerClient->stepInto(); + break; + case ID_DEBUG_STEPOVER: + m_debuggerClient->stepOver(); + break; + case ID_DEBUG_STEPOUT: + m_debuggerClient->stepOut(); + break; + case ID_DEBUG_SHOWCONSOLE: + m_debuggerClient->showConsole(); + break; + case ID_HELP_ABOUT: + DialogBox(Drosera::getInst(), MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, ::aboutWndProc); + break; + case ID_FILE_EXIT: + DestroyWindow(hWnd); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + + return 0; +} + +// Message handler for about box. +INT_PTR CALLBACK aboutWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + switch (message) { + case WM_INITDIALOG: + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { + EndDialog(hDlg, LOWORD(wParam)); + return (INT_PTR)TRUE; + } + break; + } + return (INT_PTR)FALSE; +} + +////////////////// End Setup Windows Specific Interface ////////////////// + +Drosera::Drosera() + : m_hWnd(0) + , m_debuggerClient(new DebuggerClient()) +{ +} + +HRESULT Drosera::init(HINSTANCE hInstance, int nCmdShow) +{ + HRESULT ret = initUI(hInstance, nCmdShow); + if (FAILED(ret)) + return ret; + + ret = attach(); + return ret; +} + + +HRESULT Drosera::initUI(HINSTANCE hInstance, int nCmdShow) +{ + // Initialize global strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, ARRAYSIZE(szTitle)); + LoadString(hInstance, IDC_DROSERA, szWindowClass, ARRAYSIZE(szWindowClass)); + registerDroseraClass(hInstance); + + Drosera::setInst(hInstance); // Store instance handle in our local variable + + m_hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0, 0, hInstance, 0); + + if (!m_hWnd) + return HRESULT_FROM_WIN32(GetLastError()); + + SetLastError(0); + SetWindowLongPtr(m_hWnd, 0, reinterpret_cast<LONG_PTR>(this)); + HRESULT ret = HRESULT_FROM_WIN32(GetLastError()); + if (FAILED(ret)) + return ret; + + CLSID clsid = CLSID_NULL; + ret = CLSIDFromProgID(PROGID(WebView), &clsid); + if (FAILED(ret)) + return ret; + + ret = CoCreateInstance(clsid, 0, CLSCTX_ALL, IID_IWebView, (void**)&m_webView); + if (FAILED(ret)) + return ret; + + m_webViewPrivate.query(m_webView.get()); + if (!m_webViewPrivate) + return E_FAIL; + + ret = m_webView->setHostWindow(reinterpret_cast<OLE_HANDLE>(m_hWnd)); + if (FAILED(ret)) + return ret; + + RECT clientRect = {0}; + ::GetClientRect(m_hWnd, &clientRect); + ret = m_webView->initWithFrame(clientRect, 0, 0); + if (FAILED(ret)) + return ret; + + HWND viewWindow; + ret = m_webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow)); + if (FAILED(ret)) + return ret; + + SetProp(viewWindow, s_DroseraPointerProp, (HANDLE)this); + + // FIXME: Implement window size/position save/restore + ShowWindow(m_hWnd, nCmdShow); + UpdateWindow(m_hWnd); + + return ret; +} + +LRESULT Drosera::onSize(WPARAM, LPARAM) +{ + if (!m_webViewPrivate) + return 0; + + RECT clientRect = {0}; + ::GetClientRect(m_hWnd, &clientRect); + + HWND viewWindow; + if (SUCCEEDED(m_webViewPrivate->viewWindow(reinterpret_cast<OLE_HANDLE*>(&viewWindow)))) + // FIXME should this be the height-command bars height? + ::SetWindowPos(viewWindow, 0, clientRect.left, clientRect.top, clientRect.right - clientRect.left, clientRect.bottom - clientRect.top, SWP_NOZORDER); + + return 0; +} + +bool Drosera::webViewLoaded() const +{ + return m_debuggerClient->webViewLoaded(); +} + +// Server Detection Callbacks + +HRESULT Drosera::attach() +{ + // Get selected server + HRESULT ret = m_webView->setFrameLoadDelegate(m_debuggerClient.get()); + if (FAILED(ret)) + return ret; + + ret = m_webView->setUIDelegate(m_debuggerClient.get()); + if (FAILED(ret)) + return ret; + + CLSID clsid = CLSID_NULL; + ret = CLSIDFromProgID(PROGID(WebMutableURLRequest), &clsid); + if (FAILED(ret)) + return ret; + + COMPtr<IWebMutableURLRequest> request; + ret = CoCreateInstance(clsid, 0, CLSCTX_ALL, IID_IWebMutableURLRequest, (void**)&request); + if (FAILED(ret)) + return ret; + + RetainPtr<CFURLRef> htmlURLRef(AdoptCF, ::CFBundleCopyResourceURL(::CFBundleGetBundleWithIdentifier(CFSTR("org.webkit.drosera")), CFSTR("debugger"), CFSTR("html"), CFSTR("Drosera"))); + if (!htmlURLRef) + return E_FAIL; + + CFStringRef urlStringRef = ::CFURLGetString(htmlURLRef.get()); + BSTR tempStr = cfStringToBSTR(urlStringRef); // Both initWithRUL and SysFreeString can handle 0. + ret = request->initWithURL(tempStr, WebURLRequestUseProtocolCachePolicy, 60); + SysFreeString(tempStr); + if (FAILED(ret)) + return ret; + + COMPtr<IWebFrame> mainFrame; + ret = m_webView->mainFrame(&mainFrame); + if (FAILED(ret)) + return ret; + + ret = mainFrame->loadRequest(request.get()); + if (FAILED(ret)) + return ret; + + return ret; +} + +BSTR cfStringToBSTR(CFStringRef cfstr) +{ + if (!cfstr) + return 0; + + const UniChar* uniChars = CFStringGetCharactersPtr(cfstr); + if (uniChars) + return SysAllocStringLen((LPCTSTR)uniChars, CFStringGetLength(cfstr)); + + CFIndex length = CFStringGetLength(cfstr); + BSTR bstr = SysAllocStringLen(0, length); + CFStringGetCharacters(cfstr, CFRangeMake(0, length), (UniChar*)bstr); + bstr[length] = 0; + + return bstr; +} + +// Server Connection Functions + +bool Drosera::serverConnected() const +{ + return m_debuggerClient->serverConnected(); +} + +void Drosera::attemptToCreateServerConnection() +{ + m_debuggerClient->attemptToCreateServerConnection(); +} + diff --git a/WebKitTools/Drosera/win/Drosera.h b/WebKitTools/Drosera/win/Drosera.h new file mode 100644 index 0000000..a73c7f7 --- /dev/null +++ b/WebKitTools/Drosera/win/Drosera.h @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2006, 2007 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 Drosera_H +#define Drosera_H + +#include "DebuggerDocument.h" + +#include <WebCore/COMPtr.h> +#include <wtf/OwnPtr.h> + +class DebuggerClient; +interface IWebView; +interface IWebViewPrivate; + +class Drosera { +public: + Drosera(); + + static HINSTANCE getInst(); + static void setInst(HINSTANCE); + + HRESULT init(HINSTANCE hInstance, int nCmdShow); + LRESULT onSize(WPARAM, LPARAM); + LRESULT CALLBACK handleCommand(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); + + bool webViewLoaded() const; + + // Server connection functions + bool serverConnected() const; + void attemptToCreateServerConnection(); + +private: + HRESULT initUI(HINSTANCE hInstance, int nCmdShow); + HRESULT attach(); + + HWND m_hWnd; + + COMPtr<IWebView> m_webView; + COMPtr<IWebViewPrivate> m_webViewPrivate; + + OwnPtr<DebuggerClient> m_debuggerClient; +}; + +#endif //Drosera_H diff --git a/WebKitTools/Drosera/win/Drosera.vcproj/Drosera.rc b/WebKitTools/Drosera/win/Drosera.vcproj/Drosera.rc new file mode 100755 index 0000000..6f8a8c8 --- /dev/null +++ b/WebKitTools/Drosera/win/Drosera.vcproj/Drosera.rc @@ -0,0 +1,196 @@ +// Microsoft Visual C++ generated resource script.
+//
+#include "resource.h"
+#ifndef APSTUDIO_INVOKED
+#include "autoversion.h"
+#endif
+
+#define APSTUDIO_READONLY_SYMBOLS
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 2 resource.
+//
+#define APSTUDIO_HIDDEN_SYMBOLS
+#include "windows.h"
+#undef APSTUDIO_HIDDEN_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+#undef APSTUDIO_READONLY_SYMBOLS
+
+/////////////////////////////////////////////////////////////////////////////
+// English (U.S.) resources
+
+#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU)
+#ifdef _WIN32
+LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US
+#pragma code_page(1252)
+#endif //_WIN32
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Icon
+//
+
+// Icon with lowest ID value placed first to ensure application icon
+// remains consistent on all systems.
+IDI_DROSERA ICON "Drosera.ico"
+IDI_SMALL ICON "small.ico"
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Menu
+//
+
+IDC_DROSERA MENU
+BEGIN
+ POPUP "&File"
+ BEGIN
+ MENUITEM "Close Current File", ID_FILE_CLOSECURRENTFILE
+ MENUITEM "Exit", ID_FILE_EXIT
+ END
+ POPUP "Edit"
+ BEGIN
+ MENUITEM "Undo", ID_EDIT_UNDO
+ MENUITEM "Redo", ID_EDIT_REDO
+ MENUITEM SEPARATOR
+ MENUITEM "Cut", ID_EDIT_CUT
+ MENUITEM "Copy", ID_EDIT_COPY
+ MENUITEM "Paste", ID_EDIT_PASTE
+ MENUITEM "Select All", ID_EDIT_SELECTALL
+ MENUITEM SEPARATOR
+ POPUP "Find"
+ BEGIN
+ MENUITEM "Find", ID_FIND_FIND
+ MENUITEM "Find Next", ID_FIND_FINDNEXT
+ MENUITEM "Find Previous", ID_FIND_FINDPREVIOUS
+ MENUITEM "Use Selection for Find", ID_FIND_USESELECTIONFORFIND
+ MENUITEM "Jump to Selection", ID_FIND_JUMPTOSELECTION
+ END
+ MENUITEM SEPARATOR
+ MENUITEM "Special Characters", ID_EDIT_SPECIALCHARACTERS
+ END
+ POPUP "Debug"
+ BEGIN
+ MENUITEM "Show Console", ID_DEBUG_SHOWCONSOLE
+ MENUITEM SEPARATOR
+ MENUITEM "Continue", ID_DEBUG_CONTINUE
+ MENUITEM "Pause", ID_DEBUG_PAUSE
+ MENUITEM "Step Into", ID_DEBUG_STEPINTO
+ MENUITEM "Step Over", ID_DEBUG_STEPOVER
+ MENUITEM "Step Out", ID_DEBUG_STEPOUT
+ END
+ MENUITEM "Window", ID_WINDOW
+ POPUP "Help"
+ BEGIN
+ MENUITEM "About", ID_HELP_ABOUT
+ END
+END
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Dialog
+//
+
+IDD_ABOUTBOX DIALOGEX 0, 0, 146, 62
+STYLE DS_SETFONT | DS_MODALFRAME | DS_CENTER | WS_CAPTION | WS_SYSMENU
+CAPTION "About"
+FONT 8, "System", 0, 0, 0x0
+BEGIN
+ ICON IDI_DROSERA,IDC_MYICON,64,10,20,20
+ CTEXT "Drosera Version 1.0",IDC_STATIC,0,37,146,8,SS_NOPREFIX
+END
+
+
+#ifdef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// TEXTINCLUDE
+//
+
+1 TEXTINCLUDE
+BEGIN
+ "resource.h\0"
+END
+
+2 TEXTINCLUDE
+BEGIN
+ "#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "#include ""windows.h""\r\n"
+ "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n"
+ "\0"
+END
+
+3 TEXTINCLUDE
+BEGIN
+ "\r\n"
+ "\0"
+END
+
+#endif // APSTUDIO_INVOKED
+
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// Version
+//
+
+VS_VERSION_INFO VERSIONINFO
+ FILEVERSION __VERSION_MAJOR__,__BUILD_NUMBER_MAJOR__,__BUILD_NUMBER_MINOR__,__BUILD_NUMBER_VARIANT__
+ PRODUCTVERSION __VERSION_MAJOR__,__VERSION_MINOR__,__VERSION_TINY__,0
+ FILEFLAGSMASK 0x3fL
+#ifdef _DEBUG
+ FILEFLAGS 0x1L
+#else
+ FILEFLAGS 0x0L
+#endif
+ FILEOS 0x4L
+ FILETYPE 0x2L
+ FILESUBTYPE 0x0L
+BEGIN
+ BLOCK "StringFileInfo"
+ BEGIN
+ BLOCK "040904b0"
+ BEGIN
+ VALUE "FileDescription", "Drosera JavaScript Debugger"
+ VALUE "FileVersion", __VERSION_TEXT__
+ VALUE "CompanyName", "Apple Inc."
+ VALUE "InternalName", "Drosera"
+ VALUE "LegalCopyright", "Copyright Apple Inc. 2006-2008"
+ VALUE "OriginalFilename", "Drosera.exe"
+ VALUE "ProductName", "Drosera"
+ VALUE "ProductVersion", __VERSION_TEXT__
+ END
+ END
+ BLOCK "VarFileInfo"
+ BEGIN
+ VALUE "Translation", 0x409, 1200
+ END
+END
+
+/////////////////////////////////////////////////////////////////////////////
+//
+// String Table
+//
+
+STRINGTABLE
+BEGIN
+ IDS_APP_TITLE "Drosera"
+ IDC_DROSERA "DROSERA"
+END
+
+#endif // English (U.S.) resources
+/////////////////////////////////////////////////////////////////////////////
+
+
+
+#ifndef APSTUDIO_INVOKED
+/////////////////////////////////////////////////////////////////////////////
+//
+// Generated from the TEXTINCLUDE 3 resource.
+//
+
+
+/////////////////////////////////////////////////////////////////////////////
+#endif // not APSTUDIO_INVOKED
+
diff --git a/WebKitTools/Drosera/win/Drosera.vcproj/Drosera.vcproj b/WebKitTools/Drosera/win/Drosera.vcproj/Drosera.vcproj new file mode 100755 index 0000000..3f72dda --- /dev/null +++ b/WebKitTools/Drosera/win/Drosera.vcproj/Drosera.vcproj @@ -0,0 +1,449 @@ +<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+ ProjectType="Visual C++"
+ Version="8.00"
+ Name="Drosera"
+ ProjectGUID="{91671475-2114-4D8F-A051-9A1B270F6467}"
+ RootNamespace="Drosera"
+ Keyword="Win32Proj"
+ >
+ <Platforms>
+ <Platform
+ Name="Win32"
+ />
+ </Platforms>
+ <ToolFiles>
+ </ToolFiles>
+ <Configurations>
+ <Configuration
+ Name="Debug|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)\..";"$(ProjectDir)\..\..";"$(ProjectDir)\..\..\ForwardingHeaders";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(IntDir)\include""
+ PreprocessorDefinitions="STRICT;__APPLICATION_NAME__=\"$(ProjectName)\""
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="DroseraPrefix.h"
+ ForcedIncludeFiles="DroseraPrefix.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG;__APPLICATION_NAME__=\"$(ProjectName)\""
+ Culture="1033"
+ AdditionalIncludeDirectories=""$(IntDir)\include""
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ CommandLine=""
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkLibraryDependencies="false"
+ AdditionalDependencies="CoreFoundation$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(WebKitOutputDir)\lib";"$(WebKitLibrariesDir)\lib""
+ IgnoreAllDefaultLibraries="false"
+ EmbedManagedResourceFile=""
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ LinkTimeCodeGeneration="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin36$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin36$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc36$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc36$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"

mkdir 2>NUL "$(OutDir)\$(ProjectName).resources"
xcopy /y /d "$(ProjectDir)..\Info.plist" "$(OutDir)\$(ProjectName).resources"

mkdir 2>NUL "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\*.css" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\*.html" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\*.js" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\Images\*" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Release|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\release.vsprops"
+ CharacterSet="1"
+ WholeProgramOptimization="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalOptions="/EHsc"
+ AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)\..";"$(ProjectDir)\..\..";"$(ProjectDir)\..\..\ForwardingHeaders";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(IntDir)\include""
+ PreprocessorDefinitions="STRICT;__APPLICATION_NAME__=\"$(ProjectName)\""
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="DroseraPrefix.h"
+ ForcedIncludeFiles="DroseraPrefix.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="NDEBUG;__APPLICATION_NAME__=\"$(ProjectName)\""
+ Culture="1033"
+ AdditionalIncludeDirectories=""$(IntDir)\include""
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkLibraryDependencies="false"
+ AdditionalDependencies="CoreFoundation$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
+ LinkIncremental="1"
+ AdditionalLibraryDirectories=""$(WebKitOutputDir)\lib";"$(WebKitLibrariesDir)\lib""
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ OptimizeReferences="0"
+ EnableCOMDATFolding="2"
+ OptimizeForWindows98="1"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin36$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin36$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc36$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc36$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"

mkdir 2>NUL "$(OutDir)\$(ProjectName).resources"
xcopy /y /d "$(ProjectDir)..\Info.plist" "$(OutDir)\$(ProjectName).resources"

mkdir 2>NUL "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\*.css" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\*.html" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\*.js" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\Images\*" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
"
+ />
+ </Configuration>
+ <Configuration
+ Name="Debug_Internal|Win32"
+ ConfigurationType="1"
+ InheritedPropertySheets="$(WebKitLibrariesDir)\tools\vsprops\common.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug.vsprops;$(WebKitLibrariesDir)\tools\vsprops\debug_internal.vsprops"
+ CharacterSet="1"
+ >
+ <Tool
+ Name="VCPreBuildEventTool"
+ CommandLine="set PATH=%SystemDrive%\cygwin\bin;%PATH%
bash "$(WebKitLibrariesDir)\tools\scripts\auto-version.sh" "$(IntDir)"
"
+ />
+ <Tool
+ Name="VCCustomBuildTool"
+ />
+ <Tool
+ Name="VCXMLDataGeneratorTool"
+ />
+ <Tool
+ Name="VCWebServiceProxyGeneratorTool"
+ />
+ <Tool
+ Name="VCMIDLTool"
+ />
+ <Tool
+ Name="VCCLCompilerTool"
+ AdditionalIncludeDirectories=""$(ProjectDir)";"$(ProjectDir)\..";"$(ProjectDir)\..\..";"$(ProjectDir)\..\..\ForwardingHeaders";"$(WebKitOutputDir)\Include";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(IntDir)\include""
+ PreprocessorDefinitions="STRICT;__APPLICATION_NAME__=\"$(ProjectName)\""
+ UsePrecompiledHeader="2"
+ PrecompiledHeaderThrough="DroseraPrefix.h"
+ ForcedIncludeFiles="DroseraPrefix.h"
+ />
+ <Tool
+ Name="VCManagedResourceCompilerTool"
+ />
+ <Tool
+ Name="VCResourceCompilerTool"
+ PreprocessorDefinitions="_DEBUG;__APPLICATION_NAME__=\"$(ProjectName)\""
+ Culture="1033"
+ AdditionalIncludeDirectories=""$(IntDir)\include""
+ />
+ <Tool
+ Name="VCPreLinkEventTool"
+ CommandLine=""
+ />
+ <Tool
+ Name="VCLinkerTool"
+ LinkLibraryDependencies="false"
+ AdditionalDependencies="CoreFoundation$(LibraryConfigSuffix).lib CoreGraphics$(LibraryConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib WebKitGUID$(WebKitConfigSuffix).lib WTF$(WebKitConfigSuffix).lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib"
+ LinkIncremental="2"
+ AdditionalLibraryDirectories=""$(WebKitOutputDir)\lib";"$(WebKitLibrariesDir)\lib""
+ IgnoreAllDefaultLibraries="false"
+ EmbedManagedResourceFile=""
+ DelayLoadDLLs=""
+ GenerateDebugInformation="true"
+ SubSystem="2"
+ LinkTimeCodeGeneration="0"
+ TargetMachine="1"
+ />
+ <Tool
+ Name="VCALinkTool"
+ />
+ <Tool
+ Name="VCManifestTool"
+ />
+ <Tool
+ Name="VCXDCMakeTool"
+ />
+ <Tool
+ Name="VCBscMakeTool"
+ />
+ <Tool
+ Name="VCFxCopTool"
+ />
+ <Tool
+ Name="VCAppVerifierTool"
+ />
+ <Tool
+ Name="VCWebDeploymentTool"
+ />
+ <Tool
+ Name="VCPostBuildEventTool"
+ CommandLine="mkdir 2>NUL "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CFNetwork$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreFoundation$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\CoreGraphics$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin36$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuin36$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc36$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\icuuc36$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxml2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\libxslt$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\pthreadVC2$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\SQLite3$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).dll" "$(WebKitOutputDir)\bin"
xcopy /y /d "$(WebKitLibrariesDir)\bin\zlib1$(LibraryConfigSuffix).pdb" "$(WebKitOutputDir)\bin"

mkdir 2>NUL "$(OutDir)\$(ProjectName).resources"
xcopy /y /d "$(ProjectDir)..\Info.plist" "$(OutDir)\$(ProjectName).resources"

mkdir 2>NUL "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\*.css" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\*.html" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\*.js" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
xcopy /y /d "$(ProjectDir)..\..\Images\*" "$(OutDir)\$(ProjectName).resources\$(ProjectName)"
"
+ />
+ </Configuration>
+ </Configurations>
+ <References>
+ </References>
+ <Files>
+ <Filter
+ Name="Source Files"
+ Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
+ UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
+ >
+ <File
+ RelativePath="..\DebuggerClient.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\..\DebuggerDocument.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\DebuggerDocumentPlatform.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\Drosera.cpp"
+ >
+ </File>
+ <File
+ RelativePath="..\DroseraPrefix.cpp"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ >
+ <Tool
+ Name="VCCLCompilerTool"
+ UsePrecompiledHeader="1"
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\ServerConnection.cpp"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Header Files"
+ Filter="h;hpp;hxx;hm;inl;inc;xsd"
+ UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
+ >
+ <File
+ RelativePath="..\BaseDelegate.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\config.h"
+ >
+ </File>
+ <File
+ RelativePath="..\DebuggerClient.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\DebuggerDocument.h"
+ >
+ </File>
+ <File
+ RelativePath="..\Drosera.h"
+ >
+ </File>
+ <File
+ RelativePath="..\DroseraPrefix.h"
+ >
+ </File>
+ <File
+ RelativePath="..\ServerConnection.h"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="Resource Files"
+ Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav"
+ UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
+ >
+ <File
+ RelativePath="..\..\Images\Drosera.ico"
+ >
+ </File>
+ <File
+ RelativePath=".\Drosera.rc"
+ >
+ <FileConfiguration
+ Name="Debug|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories=""$(InputDir)\WTL75\include";"$(IntDir)\include";"$(ProjectDir)..";"$(ProjectDir)..\..\Images""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Release|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories=""$(ProjectDir)..";"$(ProjectDir)..\..\Images""
+ />
+ </FileConfiguration>
+ <FileConfiguration
+ Name="Debug_Internal|Win32"
+ >
+ <Tool
+ Name="VCResourceCompilerTool"
+ AdditionalIncludeDirectories=""$(InputDir)\WTL75\include";"$(IntDir)\include";"$(ProjectDir)..";"$(ProjectDir)..\..\Images""
+ />
+ </FileConfiguration>
+ </File>
+ <File
+ RelativePath="..\resource.h"
+ >
+ </File>
+ <File
+ RelativePath="..\..\Images\small.ico"
+ >
+ </File>
+ </Filter>
+ <Filter
+ Name="WebSource"
+ >
+ <File
+ RelativePath="..\..\breakpointEditor.html"
+ >
+ </File>
+ <File
+ RelativePath="..\..\console.css"
+ >
+ </File>
+ <File
+ RelativePath="..\..\console.html"
+ >
+ </File>
+ <File
+ RelativePath="..\..\console.js"
+ >
+ </File>
+ <File
+ RelativePath="..\..\debugger.css"
+ >
+ </File>
+ <File
+ RelativePath="..\..\debugger.html"
+ >
+ </File>
+ <File
+ RelativePath="..\..\debugger.js"
+ >
+ </File>
+ <File
+ RelativePath="..\..\viewer.css"
+ >
+ </File>
+ <File
+ RelativePath="..\..\viewer.html"
+ >
+ </File>
+ </Filter>
+ </Files>
+ <Globals>
+ </Globals>
+</VisualStudioProject>
diff --git a/WebKitTools/Drosera/win/DroseraPrefix.cpp b/WebKitTools/Drosera/win/DroseraPrefix.cpp new file mode 100644 index 0000000..39d3f80 --- /dev/null +++ b/WebKitTools/Drosera/win/DroseraPrefix.cpp @@ -0,0 +1,29 @@ +/* + * Copyright (C) 2007 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "DroseraPrefix.h" diff --git a/WebKitTools/Drosera/win/DroseraPrefix.h b/WebKitTools/Drosera/win/DroseraPrefix.h new file mode 100644 index 0000000..fe608c7 --- /dev/null +++ b/WebKitTools/Drosera/win/DroseraPrefix.h @@ -0,0 +1,58 @@ +/* + * Copyright (C) 2007 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 droseraPrefix_H +#define droseraPrefix_H + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows XP or later. +#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. +#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. +#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#endif + +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +#endif + +#ifndef WIN32 +#define WIN32 1 +#endif + +#endif //droseraPrefix_H diff --git a/WebKitTools/Drosera/win/Info.plist b/WebKitTools/Drosera/win/Info.plist new file mode 100644 index 0000000..ce4a0f7 --- /dev/null +++ b/WebKitTools/Drosera/win/Info.plist @@ -0,0 +1,26 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> +<plist version="1.0"> +<dict> + <key>CFBundleDevelopmentRegion</key> + <string>English</string> + <key>CFBundleExecutable</key> + <string>Drosera</string> + <key>CFBundleIconFile</key> + <string>Drosera</string> + <key>CFBundleIdentifier</key> + <string>org.webkit.drosera</string> + <key>CFBundleInfoDictionaryVersion</key> + <string>6.0</string> + <key>CFBundlePackageType</key> + <string>APPL</string> + <key>CFBundleSignature</key> + <string>????</string> + <key>CFBundleVersion</key> + <string>21081</string> + <key>NSMainNibFile</key> + <string>MainMenu</string> + <key>NSPrincipalClass</key> + <string>NSApplication</string> +</dict> +</plist> diff --git a/WebKitTools/Drosera/win/ServerConnection.cpp b/WebKitTools/Drosera/win/ServerConnection.cpp new file mode 100644 index 0000000..de2b416 --- /dev/null +++ b/WebKitTools/Drosera/win/ServerConnection.cpp @@ -0,0 +1,368 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007 Vladimir Olexa (vladimir.olexa@gmail.com) + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 "ServerConnection.h" + +#include "DebuggerDocument.h" + +#include <JavaScriptCore/JSContextRef.h> +#include <JavaScriptCore/JSRetainPtr.h> +#include <JavaScriptCore/JSStringRefBSTR.h> +#include <JavaScriptCore/RetainPtr.h> +#include <WebKit/ForEachCoClass.h> +#include <WebKit/WebKit.h> + +#include <iostream> + +ServerConnection::ServerConnection() + : m_globalContext(0) + , m_serverConnected(false) +{ + OleInitialize(0); + attemptToCreateServerConnection(); +} + +ServerConnection::~ServerConnection() +{ + if (m_server) + m_server->removeListener(this); + + if (m_globalContext) + JSGlobalContextRelease(m_globalContext); +} + +void ServerConnection::attemptToCreateServerConnection(JSGlobalContextRef globalContextRef) +{ + COMPtr<IWebScriptDebugServer> tempServer; + + CLSID clsid = CLSID_NULL; + if (FAILED(CLSIDFromProgID(PROGID(WebScriptDebugServer), &clsid))) + return; + + if (FAILED(CoCreateInstance(clsid, 0, CLSCTX_LOCAL_SERVER, IID_IWebScriptDebugServer, (void**)&tempServer))) + return; + + if (FAILED(tempServer->sharedWebScriptDebugServer(&m_server))) + return; + + if (FAILED(m_server->addListener(this))) { + m_server = 0; + return; + } + + m_serverConnected = true; + + if (globalContextRef) + m_globalContext = JSGlobalContextRetain(globalContextRef); +} + +void ServerConnection::setGlobalContext(JSGlobalContextRef globalContextRef) +{ + m_globalContext = JSGlobalContextRetain(globalContextRef); +} + +// Pause & Step + +void ServerConnection::pause() +{ + if (m_server) + m_server->pause(); +} + +void ServerConnection::resume() +{ + if (m_server) + m_server->resume(); +} + +void ServerConnection::stepInto() +{ + if (m_server) + m_server->step(); +} + +// IUnknown -------------------------------------------------- +HRESULT STDMETHODCALLTYPE ServerConnection::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualGUID(riid, IID_IUnknown)) + *ppvObject = this; + else if (IsEqualGUID(riid, IID_IWebScriptDebugListener)) + *ppvObject = static_cast<IWebScriptDebugListener*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +ULONG STDMETHODCALLTYPE ServerConnection::AddRef(void) +{ + // COM ref-counting isn't useful to us because we're in charge of the lifetime of the WebView. + return 1; +} + +ULONG STDMETHODCALLTYPE ServerConnection::Release(void) +{ + // COM ref-counting isn't useful to us because we're in charge of the lifetime of the WebView. + return 1; +} +// IWebScriptDebugListener ----------------------------------- +HRESULT STDMETHODCALLTYPE ServerConnection::didLoadMainResourceForDataSource( + /* [in] */ IWebView*, + /* [in] */ IWebDataSource* dataSource) +{ + HRESULT ret = S_OK; + if (!m_globalContext || !dataSource) + return ret; + + // Get document source + COMPtr<IWebDocumentRepresentation> rep; + ret = dataSource->representation(&rep); + if (FAILED(ret)) + return ret; + + BOOL canProvideDocumentSource = FALSE; + ret = rep->canProvideDocumentSource(&canProvideDocumentSource); + if (FAILED(ret)) + return ret; + + BSTR documentSource = 0; + if (canProvideDocumentSource) + ret = rep->documentSource(&documentSource); + + if (FAILED(ret) || !documentSource) + return ret; + + JSRetainPtr<JSStringRef> documentSourceJS(Adopt, JSStringCreateWithBSTR(documentSource)); + SysFreeString(documentSource); + + // Get URL + COMPtr<IWebURLResponse> response; + ret = dataSource->response(&response); + if (FAILED(ret)) + return ret; + + BSTR url = 0; + ret = response->URL(&url); + if (FAILED(ret)) + return ret; + + JSRetainPtr<JSStringRef> urlJS(Adopt, JSStringCreateWithBSTR(url)); + SysFreeString(url); + + DebuggerDocument::updateFileSource(m_globalContext, documentSourceJS.get(), urlJS.get()); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE ServerConnection::didParseSource( + /* [in] */ IWebView*, + /* [in] */ BSTR sourceCode, + /* [in] */ UINT baseLineNumber, + /* [in] */ BSTR url, + /* [in] */ int sourceID, + /* [in] */ IWebFrame* webFrame) +{ + HRESULT ret = S_OK; + if (!m_globalContext || !sourceCode) + return ret; + + COMPtr<IWebDataSource> dataSource; + ret = webFrame->dataSource(&dataSource); + if (FAILED(ret)) + return ret; + + COMPtr<IWebURLResponse> response; + ret = dataSource->response(&response); + if (FAILED(ret)) + return ret; + + BSTR responseURL; + ret = response->URL(&responseURL); + if (FAILED(ret)) + return ret; + + BSTR documentSource = 0; + if (!url || !wcscmp(responseURL, url)) { + COMPtr<IWebDocumentRepresentation> rep; + ret = dataSource->representation(&rep); + if (FAILED(ret)) + return ret; + + BOOL canProvideDocumentSource; + rep->canProvideDocumentSource(&canProvideDocumentSource); + if (FAILED(ret)) + return ret; + + if (canProvideDocumentSource) { + ret = rep->documentSource(&documentSource); + if (FAILED(ret)) + return ret; + } + + if (!url) { + ret = response->URL(&url); + if (FAILED(ret)) + return ret; + } + } + SysFreeString(responseURL); + + JSRetainPtr<JSStringRef> sourceJS(Adopt, JSStringCreateWithBSTR(sourceCode)); + JSRetainPtr<JSStringRef> documentSourceJS(Adopt, JSStringCreateWithBSTR(documentSource)); + SysFreeString(documentSource); + JSRetainPtr<JSStringRef> urlJS(Adopt, JSStringCreateWithBSTR(url)); + JSValueRef sidJS = JSValueMakeNumber(m_globalContext, sourceID); + JSValueRef baseLineJS = JSValueMakeNumber(m_globalContext, baseLineNumber); + + DebuggerDocument::didParseScript(m_globalContext, sourceJS.get(), documentSourceJS.get(), urlJS.get(), sidJS, baseLineJS); + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE ServerConnection::failedToParseSource( + /* [in] */ IWebView*, + /* [in] */ BSTR, + /* [in] */ UINT, + /* [in] */ BSTR, + /* [in] */ BSTR, + /* [in] */ IWebFrame*) +{ + return S_OK; +} + +HRESULT STDMETHODCALLTYPE ServerConnection::didEnterCallFrame( + /* [in] */ IWebView*, + /* [in] */ IWebScriptCallFrame* frame, + /* [in] */ int sourceID, + /* [in] */ int lineNumber, + /* [in] */ IWebFrame*) +{ + HRESULT ret = S_OK; + if (!m_globalContext) + return ret; + + m_currentFrame = frame; + + JSValueRef sidJS = JSValueMakeNumber(m_globalContext, sourceID); + JSValueRef linenoJS = JSValueMakeNumber(m_globalContext, lineNumber); + + DebuggerDocument::didEnterCallFrame(m_globalContext, sidJS, linenoJS); + + return ret; +} + +HRESULT STDMETHODCALLTYPE ServerConnection::willExecuteStatement( + /* [in] */ IWebView*, + /* [in] */ IWebScriptCallFrame*, + /* [in] */ int sourceID, + /* [in] */ int lineNumber, + /* [in] */ IWebFrame*) +{ + HRESULT ret = S_OK; + if (!m_globalContext) + return ret; + + JSValueRef sidJS = JSValueMakeNumber(m_globalContext, sourceID); + JSValueRef linenoJS = JSValueMakeNumber(m_globalContext, lineNumber); + + DebuggerDocument::willExecuteStatement(m_globalContext, sidJS, linenoJS); + return ret; +} + +HRESULT STDMETHODCALLTYPE ServerConnection::willLeaveCallFrame( + /* [in] */ IWebView*, + /* [in] */ IWebScriptCallFrame* frame, + /* [in] */ int sourceID, + /* [in] */ int lineNumber, + /* [in] */ IWebFrame*) +{ + HRESULT ret = S_OK; + if (!m_globalContext) + return ret; + + JSValueRef sidJS = JSValueMakeNumber(m_globalContext, sourceID); + JSValueRef linenoJS = JSValueMakeNumber(m_globalContext, lineNumber); + + DebuggerDocument::willLeaveCallFrame(m_globalContext, sidJS, linenoJS); + + m_currentFrame = frame; + + return S_OK; +} + +HRESULT STDMETHODCALLTYPE ServerConnection::exceptionWasRaised( + /* [in] */ IWebView*, + /* [in] */ IWebScriptCallFrame*, + /* [in] */ int sourceID, + /* [in] */ int lineNumber, + /* [in] */ IWebFrame*) +{ + HRESULT ret = S_OK; + if (!m_globalContext) + return ret; + + JSValueRef sidJS = JSValueMakeNumber(m_globalContext, sourceID); + JSValueRef linenoJS = JSValueMakeNumber(m_globalContext, lineNumber); + + DebuggerDocument::exceptionWasRaised(m_globalContext, sidJS, linenoJS); + + return ret; +} + +HRESULT STDMETHODCALLTYPE ServerConnection::serverDidDie() +{ + m_server = 0; + m_currentFrame = 0; + m_serverConnected = false; + return S_OK; +} + +// Stack & Variables + +IWebScriptCallFrame* ServerConnection::currentFrame() const +{ + return m_currentFrame.get(); +} + +COMPtr<IWebScriptCallFrame> ServerConnection::getCallerFrame(int callFrame) const +{ + COMPtr<IWebScriptCallFrame> cframe = currentFrame(); + for (int count = 0; count < callFrame; count++) { + COMPtr<IWebScriptCallFrame> callerFrame; + if (FAILED(cframe->caller(&callerFrame))) + return 0; + + cframe = callerFrame; + } + + return cframe; +} diff --git a/WebKitTools/Drosera/win/ServerConnection.h b/WebKitTools/Drosera/win/ServerConnection.h new file mode 100644 index 0000000..c0b64cf --- /dev/null +++ b/WebKitTools/Drosera/win/ServerConnection.h @@ -0,0 +1,128 @@ +/* + * Copyright (C) 2007 Apple Inc. All rights reserved. + * Copyright (C) 2006, 2007 Vladimir Olexa (vladimir.olexa@gmail.com) + * + * 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. + * 3. Neither the name of Apple Computer, Inc. ("Apple") nor the names of + * its contributors may be used to endorse or promote products derived + * from this software without specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "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 OR ITS 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 ServerConnection_H +#define ServerConnection_H + +#include <string> +#include <WebCore/COMPtr.h> +#include <WebKit/WebKit.h> + +class DebuggerClient; +interface IWebScriptCallFrame; +interface IWebScriptDebugServer; + +typedef struct OpaqueJSContext* JSGlobalContextRef; + +class ServerConnection : public IWebScriptDebugListener { +public: + ServerConnection(); + ~ServerConnection(); + + bool serverConnected() const { return m_serverConnected; } + void attemptToCreateServerConnection(JSGlobalContextRef = 0); + void setGlobalContext(JSGlobalContextRef); + + // Pause & Step + void pause(); + void resume(); + void stepInto(); + + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface( + /* [in] */ REFIID riid, + /* [retval][out] */ void** ppvObject); + + virtual ULONG STDMETHODCALLTYPE AddRef(); + virtual ULONG STDMETHODCALLTYPE Release(); + + // IWebScriptDebugListener + virtual HRESULT STDMETHODCALLTYPE didLoadMainResourceForDataSource( + /* [in] */ IWebView*, + /* [in] */ IWebDataSource* dataSource); + + virtual HRESULT STDMETHODCALLTYPE didParseSource( + /* [in] */ IWebView*, + /* [in] */ BSTR sourceCode, + /* [in] */ UINT baseLineNumber, + /* [in] */ BSTR url, + /* [in] */ int sourceID, + /* [in] */ IWebFrame* webFrame); + + virtual HRESULT STDMETHODCALLTYPE failedToParseSource( + /* [in] */ IWebView*, + /* [in] */ BSTR sourceCode, + /* [in] */ UINT baseLineNumber, + /* [in] */ BSTR url, + /* [in] */ BSTR error, + /* [in] */ IWebFrame*); + + virtual HRESULT STDMETHODCALLTYPE didEnterCallFrame( + /* [in] */ IWebView*, + /* [in] */ IWebScriptCallFrame* frame, + /* [in] */ int sourceID, + /* [in] */ int lineNumber, + /* [in] */ IWebFrame*); + + virtual HRESULT STDMETHODCALLTYPE willExecuteStatement( + /* [in] */ IWebView*, + /* [in] */ IWebScriptCallFrame*, + /* [in] */ int sourceID, + /* [in] */ int lineNumber, + /* [in] */ IWebFrame*); + + virtual HRESULT STDMETHODCALLTYPE willLeaveCallFrame( + /* [in] */ IWebView*, + /* [in] */ IWebScriptCallFrame* frame, + /* [in] */ int sourceID, + /* [in] */ int lineNumber, + /* [in] */ IWebFrame*); + + virtual HRESULT STDMETHODCALLTYPE exceptionWasRaised( + /* [in] */ IWebView*, + /* [in] */ IWebScriptCallFrame*, + /* [in] */ int sourceID, + /* [in] */ int lineNumber, + /* [in] */ IWebFrame*); + + virtual HRESULT STDMETHODCALLTYPE serverDidDie(); + + // Stack & Variables + IWebScriptCallFrame* currentFrame() const; + COMPtr<IWebScriptCallFrame> getCallerFrame(int callFrame) const; + +private: + bool m_serverConnected; + + COMPtr<IWebScriptCallFrame> m_currentFrame; + COMPtr<IWebScriptDebugServer> m_server; + JSGlobalContextRef m_globalContext; +}; + +#endif //ServerConnection_H diff --git a/WebKitTools/Drosera/win/resource.h b/WebKitTools/Drosera/win/resource.h new file mode 100644 index 0000000..4ba014e --- /dev/null +++ b/WebKitTools/Drosera/win/resource.h @@ -0,0 +1,47 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by Drosera.rc +// +#define IDC_MYICON 2 +#define IDS_APP_TITLE 103 +#define IDD_ABOUTBOX 103 +#define IDI_DROSERA 107 +#define IDI_SMALL 108 +#define IDC_DROSERA 109 +#define IDC_LIST1 1001 +#define ID_DEBUG_SHOWCONSOLE 32771 +#define ID_DEBUG_CONTINUE 32772 +#define ID_DEBUG_PAUSE 32773 +#define ID_DEBUG_STEPINTO 32774 +#define ID_DEBUG_STEPOVER 32775 +#define ID_DEBUG_STEPOUT 32776 +#define ID_EDIT_UNDO 32777 +#define ID_EDIT_REDO 32778 +#define ID_EDIT_CUT 32779 +#define ID_EDIT_COPY 32780 +#define ID_EDIT_PASTE 32781 +#define ID_EDIT_SELECTALL 32782 +#define ID_FIND_FIND 32784 +#define ID_FIND_FINDNEXT 32785 +#define ID_FIND_FINDPREVIOUS 32786 +#define ID_FIND_USESELECTIONFORFIND 32787 +#define ID_FIND_JUMPTOSELECTION 32788 +#define ID_EDIT_SPECIALCHARACTERS 32789 +#define ID_FILE_EXIT 32791 +#define ID_WINDOW 32793 +#define ID_HELP_ABOUT 32794 +#define ID_FILE_CLOSE_CURRENT_FILE 32795 +#define ID_FILE_CLOSECURRENTFILE 32798 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 131 +#define _APS_NEXT_COMMAND_VALUE 32799 +#define _APS_NEXT_CONTROL_VALUE 1002 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif |