WebKit/win:
authorkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2007 23:03:08 +0000 (23:03 +0000)
committerkmccullough@apple.com <kmccullough@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 26 Nov 2007 23:03:08 +0000 (23:03 +0000)
        Reviewed by Maciej.

        - Implemented displaying variables for Drosera on Win.

        * Interfaces/IWebScriptCallFrame.idl: Added a local function to be
        able to access the WebScriptCallFrame.
        * Interfaces/IWebScriptScope.idl: Implemented.
        * Interfaces/WebKit.idl: Added WebScriptScope to the tlb.
        * WebKit.vcproj/Interfaces.vcproj:
        * WebScriptCallFrame.cpp: Implemented the helper and accessor methods.
        (EnumScopes::Next): Fixed a bug where we did not release correctly and
        would accidentally destroy scopes.
        (WebScriptCallFrame::stringByEvaluatingJavaScriptFromString):
        Implemented.
        (WebScriptCallFrame::valueByEvaluatingJavaScriptFromString): Implemented
        * WebScriptCallFrame.h: Implemented the helper and accessor methods.
        (WebScriptCallFrame::impl):
        (WebScriptCallFrame::state):
        * WebScriptScope.cpp: Implmented.
        (EnumVariables::EnumVariables): Created an IEnumVariant over the
        variables to be able to pass a DCOM acceptable structure back to
        Drosera.
        (EnumVariables::createInstance):
        (EnumVariables::QueryInterface):
        (EnumVariables::AddRef):
        (EnumVariables::Release):
        (EnumVariables::Next):
        (EnumVariables::Skip):
        (EnumVariables::Reset):
        (EnumVariables::Clone):
        (WebScriptScope::WebScriptScope):
        (WebScriptScope::createInstance): Implemented.
        (WebScriptScope::variableNames): Implemented.
        (WebScriptScope::valueForVariable):
        * WebScriptScope.h: Implmeneted.

WebKitTools:

        Reviewed by Maciej.

        - Implemented displaying variables for Drosera on Win.

        * Drosera/win/DebuggerDocumentPlatform.cpp: Changed Drosera functions
        that retrieve variables to not hold onto the return value since it's
        not returned.  Also changed to use the new signatures of the retrieval
        functions.
        (DebuggerDocument::getPlatformLocalScopeVariableNamesForCallFrame):
        (DebuggerDocument::platformValueForScopeVariableNamed):
        * Drosera/win/Drosera.cpp: Removed a needless TODO.
        (droseraWndProc):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@28050 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKit/win/ChangeLog
WebKit/win/Interfaces/IWebScriptCallFrame.idl
WebKit/win/Interfaces/IWebScriptScope.idl
WebKit/win/Interfaces/WebKit.idl
WebKit/win/WebScriptCallFrame.cpp
WebKit/win/WebScriptCallFrame.h
WebKit/win/WebScriptScope.cpp
WebKit/win/WebScriptScope.h
WebKitTools/ChangeLog
WebKitTools/Drosera/win/DebuggerDocumentPlatform.cpp
WebKitTools/Drosera/win/Drosera.cpp

index 4d39c0d7a56e4c960474bd82327cde8a1ffa9016..3f58a82651f3b7c961f3790d1d6f0dbac4f69046 100644 (file)
@@ -1,3 +1,41 @@
+2007-11-26  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Maciej.
+
+        - Implemented displaying variables for Drosera on Win.
+
+        * Interfaces/IWebScriptCallFrame.idl: Added a local function to be
+        able to access the WebScriptCallFrame.
+        * Interfaces/IWebScriptScope.idl: Implemented.
+        * Interfaces/WebKit.idl: Added WebScriptScope to the tlb.
+        * WebKit.vcproj/Interfaces.vcproj: 
+        * WebScriptCallFrame.cpp: Implemented the helper and accessor methods.
+        (EnumScopes::Next): Fixed a bug where we did not release correctly and
+        would accidentally destroy scopes.
+        (WebScriptCallFrame::stringByEvaluatingJavaScriptFromString):
+        Implemented.
+        (WebScriptCallFrame::valueByEvaluatingJavaScriptFromString): Implemented
+        * WebScriptCallFrame.h: Implemented the helper and accessor methods.
+        (WebScriptCallFrame::impl):
+        (WebScriptCallFrame::state):
+        * WebScriptScope.cpp: Implmented.
+        (EnumVariables::EnumVariables): Created an IEnumVariant over the
+        variables to be able to pass a DCOM acceptable structure back to
+        Drosera.
+        (EnumVariables::createInstance):
+        (EnumVariables::QueryInterface):
+        (EnumVariables::AddRef):
+        (EnumVariables::Release):
+        (EnumVariables::Next):
+        (EnumVariables::Skip):
+        (EnumVariables::Reset):
+        (EnumVariables::Clone):
+        (WebScriptScope::WebScriptScope):
+        (WebScriptScope::createInstance): Implemented.
+        (WebScriptScope::variableNames): Implemented.
+        (WebScriptScope::valueForVariable):
+        * WebScriptScope.h: Implmeneted.
+
 2007-11-26  Anders Carlsson  <andersca@apple.com>
 
         Reviewed by Brady.
index a69174a12be53edc2d920cb7c392098971b7f003..4ceeb84208aa07bc5c0131dbd9685187c749072a 100644 (file)
@@ -57,6 +57,13 @@ cpp_quote(" */")
 import "oaidl.idl";\r
 import "ocidl.idl";\r
 \r
+cpp_quote("// this is done to get midl to treat the WebScriptCallFrame type as a pointer type")\r
+cpp_quote("#if 0")\r
+typedef void* WebScriptCallFrame;\r
+cpp_quote("#else")\r
+cpp_quote("class WebScriptCallFrame;")\r
+cpp_quote("#endif")\r
+\r
 [\r
     object,\r
     oleautomation,\r
@@ -69,4 +76,6 @@ interface IWebScriptCallFrame : IUnknown
     HRESULT scopeChain([out, retval] IEnumVARIANT**);\r
     HRESULT functionName([out, retval] BSTR*);\r
     HRESULT stringByEvaluatingJavaScriptFromString([in] BSTR script, [out, retval] BSTR*);\r
+\r
+    [local] WebScriptCallFrame* impl();\r
 }\r
index dd3ec71951f29d97fc55e3d8a1c2ba22e47a2143..1664af41219c1b3e059e0ec8a1df79e2f49acd57 100644 (file)
@@ -57,6 +57,10 @@ cpp_quote(" */")
 import "oaidl.idl";
 import "ocidl.idl";
 
+import "IWebScriptCallFrame.idl";
+
+interface IWebScriptCallFrame;
+
 [
     object,
     oleautomation,
@@ -65,6 +69,6 @@ import "ocidl.idl";
 ]
 interface IWebScriptScope : IUnknown
 {
-    HRESULT variableNames([out, retval] IEnumVARIANT**);
-    HRESULT valueForVariable([in] BSTR key, [out, retval] BSTR* value);
+    HRESULT variableNames([in] IWebScriptCallFrame*, [out, retval] IEnumVARIANT**);
+    HRESULT valueForVariable([in] IWebScriptCallFrame*, [in] BSTR key, [out, retval] BSTR* value);
 }
index 091b23659c2095a5c907bd3e6834d9ff5a63d344..9876d722abb6475aa08026ee18b3996ce37b0c83 100644 (file)
@@ -82,6 +82,7 @@ import "IWebHistory.idl";
 import "IWebCache.idl";
 import "IWebJavaScriptCollector.idl";
 import "IWebKitStatistics.idl";
+import "IWebScriptScope.idl";
 import "IWebScrollBarPrivate.idl";
 import "IWebScriptDebugServer.idl";
 
@@ -290,4 +291,13 @@ library OpenSourceWebKit
     coclass WebTextRenderer {
         [default] interface IWebTextRenderer;
     }
+
+#if __BUILDBOT__
+    [uuid(C7A0B00C-5869-4b48-BB69-B5B1C4079031)]
+#else
+    [uuid(77F0CC68-5AA1-452d-996D-FA78C28E7020)]
+#endif
+    coclass WebScriptScope {
+        [default] interface IWebScriptScope;
+    }
 }
index 0bdf3419d63c71386e221f4f373f819c9e5284e0..caa31eaaa36a6530c74393869a550f48776d5df1 100644 (file)
@@ -30,7 +30,6 @@
 #include "WebKitDLL.h"
 #include "WebScriptCallFrame.h"
 
-#include "Identifier.h"
 #include "IWebScriptScope.h"
 #include "Function.h"
 #include "WebScriptScope.h"
@@ -122,14 +121,13 @@ HRESULT STDMETHODCALLTYPE EnumScopes::Next(ULONG celt, VARIANT* rgVar, ULONG* pC
         return S_FALSE;
 
     // Create a WebScriptScope from the m_current then put it in an IUnknown.
-    COMPtr<IWebScriptScope> scope = WebScriptScope::createInstance(*m_current);
-    COMPtr<IUnknown> unknown = static_cast<IUnknown*>(scope.get());
+    COMPtr<IWebScriptScope> scope(AdoptCOM, WebScriptScope::createInstance(*m_current));
     ++m_current;
-    if (!unknown)
+    if (!scope)
         return E_FAIL;
 
     V_VT(rgVar) = VT_UNKNOWN;
-    V_UNKNOWN(rgVar) = unknown.get();
+    V_UNKNOWN(rgVar) = scope.releaseRef();
 
     if (pCeltFetched)
         *pCeltFetched = 1;
@@ -250,7 +248,6 @@ HRESULT STDMETHODCALLTYPE WebScriptCallFrame::functionName(
     return S_OK;
 }
 
-
 HRESULT STDMETHODCALLTYPE WebScriptCallFrame::stringByEvaluatingJavaScriptFromString(
     /* [in] */ BSTR script,
     /* [out, retval] */ BSTR* result)
@@ -265,6 +262,18 @@ HRESULT STDMETHODCALLTYPE WebScriptCallFrame::stringByEvaluatingJavaScriptFromSt
 
     JSLock lock;
 
+    JSValue* scriptExecutionResult = valueByEvaluatingJavaScriptFromString(script);
+
+    if (scriptExecutionResult && scriptExecutionResult->isString())
+        *result = WebCore::BString(WebCore::String(scriptExecutionResult->getString())).release();
+    else
+        return E_FAIL;
+
+    return S_OK;
+}
+
+JSValue* WebScriptCallFrame::valueByEvaluatingJavaScriptFromString(BSTR script)
+{
     ExecState* state = m_state;
     Interpreter* interp  = state->dynamicInterpreter();
     JSObject* globObj = interp->globalObject();
@@ -299,12 +308,6 @@ HRESULT STDMETHODCALLTYPE WebScriptCallFrame::stringByEvaluatingJavaScriptFromSt
         scriptExecutionResult = state->exception();    // (may be redundant depending on which eval path was used)
     state->setException(savedException);
 
-    if (!scriptExecutionResult)
-        return E_FAIL;
-
-    scriptExecutionResult->isString();
-    *result = WebCore::BString(WebCore::String(scriptExecutionResult->getString())).release();
-
-    return S_OK;
+    return scriptExecutionResult;
 }
 
index 1a565fa965ffe36675564d53df9e5584ced7d4fa..a2263ab2d18919c316721ea9b9ece355c466630a 100644 (file)
 #include <WebCore/COMPtr.h>
 #pragma warning(pop)
 
+namespace KJS {
+    class ExecState;
+    class JSValue;
+}
+
 class WebScriptCallFrame : public IWebScriptCallFrame {
 public:
     static WebScriptCallFrame* createInstance(KJS::ExecState*, IWebScriptCallFrame* caller);
@@ -68,6 +73,12 @@ public:
         /* [in] */ BSTR script,
         /* [out, retval] */ BSTR*);
 
+    virtual /* [local] */ WebScriptCallFrame *STDMETHODCALLTYPE impl() { return this; }
+
+    // Helper and accessors
+    virtual KJS::JSValue* valueByEvaluatingJavaScriptFromString(BSTR script);
+    virtual KJS::ExecState* state() const { return m_state; }
+
 private:
     KJS::ExecState* m_state;
     COMPtr<IWebScriptCallFrame> m_caller;
index 8274105c87d4c9d505fe7f95abd52af678547b97..5c1d7a150b54880dad18a37ae184a626172f0c20 100644 (file)
 #include "WebKitDLL.h"
 #include "WebScriptScope.h"
 
+#include "WebScriptCallFrame.h"
+
+#include <memory>
+#include <JavaScriptCore/PropertyNameArray.h>
 #include <wtf/Assertions.h>
+#include <wtf/OwnPtr.h>
+
+#pragma warning(push, 0)
+#include <WebCore/BString.h>
+#include <WebCore/PlatformString.h>
+#pragma warning(pop)
+
+using namespace KJS;
+using namespace std;
+
+// EnumVariables -----------------------------------------------------------------
+
+class EnumVariables : public IEnumVARIANT {
+public:
+    static EnumVariables* createInstance(auto_ptr<PropertyNameArray>);
+
+private:
+    EnumVariables(auto_ptr<PropertyNameArray> variableNames)
+        : m_refCount(0)
+        , m_names(variableNames.release())
+        , m_current(m_names->begin())
+    {
+    }
+
+public:
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID, void** ppvObject);
+    virtual ULONG STDMETHODCALLTYPE AddRef();
+    virtual ULONG STDMETHODCALLTYPE Release();
+    virtual HRESULT STDMETHODCALLTYPE Next(ULONG celt, VARIANT* rgVar, ULONG* pCeltFetched);
+    virtual HRESULT STDMETHODCALLTYPE Skip(ULONG celt);
+    virtual HRESULT STDMETHODCALLTYPE Reset(void);
+    virtual HRESULT STDMETHODCALLTYPE Clone(IEnumVARIANT**);
+
+private:
+    ULONG m_refCount;
+    OwnPtr<PropertyNameArray> m_names;
+    PropertyNameArrayIterator m_current;
+};
+
+EnumVariables* EnumVariables::createInstance(auto_ptr<PropertyNameArray> variableNames)
+{
+    EnumVariables* instance = new EnumVariables(variableNames);
+    instance->AddRef();
+    return instance;
+}
+
+HRESULT STDMETHODCALLTYPE EnumVariables::QueryInterface(REFIID riid, void** ppvObject)
+{
+    *ppvObject = 0;
+    if (IsEqualGUID(riid, IID_IUnknown) || IsEqualGUID(riid, IID_IEnumVARIANT))
+        *ppvObject = this;
+    else
+        return E_NOINTERFACE;
+
+    AddRef();
+    return S_OK;
+}
+
+ULONG STDMETHODCALLTYPE EnumVariables::AddRef()
+{
+    return ++m_refCount;
+}
+
+ULONG STDMETHODCALLTYPE EnumVariables::Release()
+{
+    ULONG newRef = --m_refCount;
+    if (!newRef)
+        delete(this);
+    return newRef;
+}
+
+HRESULT STDMETHODCALLTYPE EnumVariables::Next(ULONG celt, VARIANT* rgVar, ULONG* pCeltFetched)
+{
+    if (pCeltFetched)
+        *pCeltFetched = 0;
+    if (!rgVar)
+        return E_POINTER;
+    VariantInit(rgVar);
+    if (!celt || celt > 1)
+        return S_FALSE;
+    if (m_current == m_names->end())
+        return S_FALSE;
+
+    V_VT(rgVar) = VT_BSTR;
+    V_BSTR(rgVar) = WebCore::BString(*m_current).release();
+    ++m_current;
+
+    if (pCeltFetched)
+        *pCeltFetched = 1;
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE EnumVariables::Skip(ULONG celt)
+{
+    for (ULONG i = 0; i < celt; ++i)
+        ++m_current;
+    return (m_current != m_names->end()) ? S_OK : S_FALSE;
+}
+
+HRESULT STDMETHODCALLTYPE EnumVariables::Reset(void)
+{
+    m_current = 0;
+    return S_OK;
+}
+
+HRESULT STDMETHODCALLTYPE EnumVariables::Clone(IEnumVARIANT**)
+{
+    return E_NOTIMPL;
+}
 
 // WebScriptScope ------------------------------------------------------------
 
-WebScriptScope::WebScriptScope(KJS::JSObject* scope)
+WebScriptScope::WebScriptScope(JSObject* scope)
     : m_refCount(0)
     , m_scope(scope)
 {
@@ -46,7 +159,7 @@ WebScriptScope::~WebScriptScope()
     gClassCount--;
 }
 
-WebScriptScope* WebScriptScope::createInstance(KJS::JSObject* scope)
+WebScriptScope* WebScriptScope::createInstance(JSObject* scope)
 {
     WebScriptScope* instance = new WebScriptScope(scope);
     instance->AddRef();
@@ -86,16 +199,67 @@ ULONG STDMETHODCALLTYPE WebScriptScope::Release(void)
 // WebScriptScope ------------------------------------------------------------
 
 HRESULT STDMETHODCALLTYPE WebScriptScope::variableNames(
-    /* [out, retval] */ IEnumVARIANT**)
+    /* [in] */ IWebScriptCallFrame* frame,
+    /* [out, retval] */ IEnumVARIANT** variableNames)
 {
-    ASSERT_NOT_REACHED();
-    return E_NOTIMPL;
+    if (!frame)
+        return E_FAIL;
+
+    if (!variableNames)
+        return E_POINTER;
+
+    *variableNames = 0;
+
+    auto_ptr<PropertyNameArray> props(new PropertyNameArray);
+    m_scope->getPropertyNames(frame->impl()->state(), *(props.get()));
+
+    *variableNames = EnumVariables::createInstance(props);
+
+    return S_OK;
 }
 
 HRESULT STDMETHODCALLTYPE WebScriptScope::valueForVariable(
-    /* [in] */ BSTR /*key*/,
-    /* [out, retval] */ BSTR* /*value*/)
+    /* [in] */ IWebScriptCallFrame* frame,
+    /* [in] */ BSTR key,
+    /* [out, retval] */ BSTR* value)
 {
-    ASSERT_NOT_REACHED();
-    return E_NOTIMPL;
+    if (!frame || !key)
+        return E_FAIL;
+
+    if (!value)
+        return E_POINTER;
+
+    *value = 0;
+
+    Identifier identKey(reinterpret_cast<KJS::UChar*>(key), SysStringLen(key));
+
+    JSValue* jsvalue = m_scope->get(frame->impl()->state(), identKey);
+
+    UString string;
+    const JSType type = jsvalue->type();
+    switch (type) {
+        case NullType:
+        case UndefinedType:
+        case UnspecifiedType:
+        case GetterSetterType:
+            break;
+        case StringType:
+            string = jsvalue->getString();
+            break;
+        case NumberType:
+            string = UString::from(jsvalue->getNumber());
+            break;
+        case BooleanType:
+            string = jsvalue->getBoolean() ? "True" : "False";
+            break;
+        case ObjectType: {
+            JSObject* jsobject = jsvalue->getObject();
+            jsvalue = jsobject->defaultValue(frame->impl()->state(), StringType);
+            string = jsvalue->getString();
+            break;
+        }
+    }
+
+    *value = WebCore::BString(string).release();
+    return S_OK;
 }
index 988d1ba34f91dfbfe61cb066490db8c101cf96e1..aafc1d9ca83f40529dc444e1e25be6f106a20f06 100644 (file)
@@ -43,15 +43,21 @@ private:
 
 public:
     // IUnknown
-    virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject);
-    virtual ULONG STDMETHODCALLTYPE AddRef(void);
-    virtual ULONG STDMETHODCALLTYPE Release(void);
+    virtual HRESULT STDMETHODCALLTYPE QueryInterface(
+        /* [in] */ REFIID,
+        /* [retval][out] */ void** ppvObject);
+
+    virtual ULONG STDMETHODCALLTYPE AddRef();
+
+    virtual ULONG STDMETHODCALLTYPE Release();
 
     // IWebScriptScope
-    virtual HRESULT STDMETHODCALLTYPE variableNames(
-        /* [out, retval] */ IEnumVARIANT**);
+    virtual HRESULT STDMETHODCALLTYPE variableNames( 
+        /* [in] */ IWebScriptCallFrame*,
+        /* [retval][out] */ IEnumVARIANT**);
 
     virtual HRESULT STDMETHODCALLTYPE valueForVariable(
+        /* [in] */ IWebScriptCallFrame*,
         /* [in] */ BSTR key,
         /* [out, retval] */ BSTR* value);
     
index 14cfd28ccedd6079129dbdf8d1c543489b589f43..f7f0665c661d5f19109f72a47a669182e79d7a78 100644 (file)
@@ -1,3 +1,18 @@
+2007-11-26  Kevin McCullough  <kmccullough@apple.com>
+
+        Reviewed by Maciej.
+
+        - Implemented displaying variables for Drosera on Win.
+
+        * Drosera/win/DebuggerDocumentPlatform.cpp: Changed Drosera functions
+        that retrieve variables to not hold onto the return value since it's
+        not returned.  Also changed to use the new signatures of the retrieval
+        functions.
+        (DebuggerDocument::getPlatformLocalScopeVariableNamesForCallFrame):
+        (DebuggerDocument::platformValueForScopeVariableNamed):
+        * Drosera/win/Drosera.cpp: Removed a needless TODO.
+        (droseraWndProc):
+
 2007-11-26  Sam Weinig  <sam@webkit.org>
 
         Cleanup names of painting and repainting functions.
index ecf9d99748fb059d0a38fe1df44c65e71c287208..6b616b9365f381d6c48e60f2b1075c39045fd04e 100644 (file)
@@ -113,21 +113,18 @@ void DebuggerDocument::getPlatformCurrentFunctionStack(JSContextRef context, Vec
 
 void DebuggerDocument::getPlatformLocalScopeVariableNamesForCallFrame(JSContextRef context, int callFrame, Vector<JSValueRef>& variableNames)
 {
-    HRESULT ret = S_OK;
-
+    // FIXME: Move the retrieval of local variables into IWebScriptCallFrame to reduce the number of RPCs and simplify the code.
     COMPtr<IWebScriptCallFrame> cframe = m_server->getCallerFrame(callFrame);
     if (!cframe)
         return;
 
     COMPtr<IEnumVARIANT> scopeChain;
-    ret = cframe->scopeChain(&scopeChain);
-    if (FAILED(ret))
+    if (FAILED(cframe->scopeChain(&scopeChain)))
         return;
 
     VARIANT var;
     VariantInit(&var);
-    ret = scopeChain->Next(1, &var, 0); // local is always first
-    if (FAILED(ret)) {
+    if (FAILED(scopeChain->Next(1, &var, 0))) { // local is always first
         VariantClear(&var);
         return;
     }
@@ -140,8 +137,7 @@ void DebuggerDocument::getPlatformLocalScopeVariableNamesForCallFrame(JSContextR
         return;
 
     COMPtr<IEnumVARIANT> localScopeVariableNames;
-    ret = scope->variableNames(&localScopeVariableNames);
-    if (FAILED(ret))
+    if (FAILED(scope->variableNames(cframe.get(), &localScopeVariableNames)))
         return;
 
     while (localScopeVariableNames->Next(1, &var, 0) == S_OK) {
@@ -158,15 +154,12 @@ void DebuggerDocument::getPlatformLocalScopeVariableNamesForCallFrame(JSContextR
 
 JSValueRef DebuggerDocument::platformValueForScopeVariableNamed(JSContextRef context, JSStringRef key, int callFrame)
 {
-    HRESULT ret = S_OK;
-
     COMPtr<IWebScriptCallFrame> cframe = m_server->getCallerFrame(callFrame);
     if (!cframe)
         return JSValueMakeUndefined(context);
 
     COMPtr<IEnumVARIANT> scopeChain;
-    ret = cframe->scopeChain(&scopeChain);
-    if (FAILED(ret))
+    if (FAILED(cframe->scopeChain(&scopeChain)))
         return JSValueMakeUndefined(context);
 
     VARIANT var;
@@ -182,14 +175,13 @@ JSValueRef DebuggerDocument::platformValueForScopeVariableNamed(JSContextRef con
         if (!scope)
             return JSValueMakeUndefined(context);
 
-        ret = scope->valueForVariable(bstrKey, &resultString);
-        VariantClear(&var);
-
-        if (FAILED(ret)) {
+        if (FAILED(scope->valueForVariable(cframe.get(), bstrKey, &resultString))) {
+            VariantClear(&var);
             SysFreeString(bstrKey);
             SysFreeString(resultString);
             return JSValueMakeUndefined(context);
         }
+        VariantClear(&var);
     }
     SysFreeString(bstrKey);
 
index efbc3b4593cdd6d71d5f80df161eceaea1b81595..5ae0d9027d42bdb9de74879536bd105729c75158 100644 (file)
@@ -154,7 +154,6 @@ LRESULT CALLBACK droseraWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
             return drosera->webViewLoaded() ? drosera->onSize(wParam, lParam) : 0;
         case WM_PAINT:
             hdc = BeginPaint(hWnd, &ps);
-            // TODO: Add any drawing code here...
             EndPaint(hWnd, &ps);
             break;
         case WM_DESTROY: