Reviewed by Adam.
[WebKit-https.git] / WebKitTools / Drosera / win / ServerConnection.cpp
index 89388831222609db4f143bc5bc7b440ef00a57ba..7348d8026fba557626046e99ed6c535ca2da363d 100644 (file)
@@ -34,7 +34,7 @@
 
 #include <JavaScriptCore/JSContextRef.h>
 #include <JavaScriptCore/JSRetainPtr.h>
-#include <JavaScriptCore/JSStringRefCOM.h>
+#include <JavaScriptCore/JSStringRefBSTR.h>
 #include <JavaScriptCore/RetainPtr.h>
 #include <WebKit/WebKit.h>
 
@@ -99,6 +99,20 @@ IWebScriptCallFrame* ServerConnection::currentFrame() const
     return m_currentFrame;
 }
 
+IWebScriptCallFrame* ServerConnection::getCallerFrame(int callFrame) const
+{
+    COMPtr<IWebScriptCallFrame> cframe = currentFrame();
+    COMPtr<IWebScriptCallFrame> callerFrame;
+    for (int count = 0; count < callFrame; count++) {
+        if (FAILED(cframe->caller(&callerFrame)))
+            return 0;
+
+        cframe = callerFrame;
+    }
+
+    return cframe.get();
+}
+
 
 // IUnknown --------------------------------------------------
 HRESULT STDMETHODCALLTYPE ServerConnection::QueryInterface(REFIID riid, void** ppvObject)