Reviewed by Adam and Geoff.
- Added a new cast so all the casts are in the same place.
* API/APICast.h:
(toGlobalRef):
win:
Reviewed by Adam and Geoff.
- Added the globalContext method so Drosera can ask a WebFrame for its
context.
* Interfaces/IWebFrame.idl:
* WebFrame.cpp:
* WebFrame.h:
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@27275
268f45cc-cd09-0410-ab3c-
d52691b4dbfc
#define APICast_h
#include "ustring.h"
+#include "ExecState.h"
namespace KJS {
class ExecState;
return reinterpret_cast<JSContextRef>(e);
}
+inline JSGlobalContextRef toGlobalRef(KJS::ExecState* e)
+{
+ ASSERT(!e->callingExecState());
+ return reinterpret_cast<JSGlobalContextRef>(e);
+}
+
inline JSPropertyNameAccumulatorRef toRef(KJS::PropertyNameArray* l)
{
return reinterpret_cast<JSPropertyNameAccumulatorRef>(l);
+2007-10-30 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam and Geoff.
+
+ - Added a new cast so all the casts are in the same place.
+
+ * API/APICast.h:
+ (toGlobalRef):
+
2007-10-30 Geoffrey Garen <ggaren@apple.com>
Reviewed by Darin Adler.
+2007-10-30 Kevin McCullough <kmccullough@apple.com>
+
+ Reviewed by Adam and Geoff.
+
+ - Added the globalContext method so Drosera can ask a WebFrame for its
+ context.
+
+ * Interfaces/IWebFrame.idl:
+ * WebFrame.cpp:
+ * WebFrame.h:
+
2007-10-30 Adele Peterson <adele@apple.com>
Reviewed by Darin.
import "IWebURLRequest.idl";
import "DOMCore.idl";
+cpp_quote("// this is done to get midl to treat the JavaScriptCore API types as pointer types")
+cpp_quote("#if 0")
+typedef void* JSGlobalContextRef;
+cpp_quote("#else")
+cpp_quote("typedef struct OpaqueJSContext* JSGlobalContextRef;")
+cpp_quote("#endif")
+
interface IDOMDocument;
interface IDOMHTMLElement;
interface IWebURLRequest;
- (BOOL)allowsScrolling;
*/
HRESULT allowsScrolling([out, retval] BOOL* flag);
+
+ /*!
+ @method globalContext
+ @result The frame's global JavaScript execution context. Use this method to
+ bridge between the WebKit and JavaScriptCore APIs.
+ */
+ [local] HRESULT globalContext([out, retval] JSGlobalContextRef* context);
}
return *currentForm ? S_OK : E_FAIL;
}
+HRESULT STDMETHODCALLTYPE WebFrame::globalContext(
+ /* [retval][out] */ JSGlobalContextRef* context)
+{
+ if (!context)
+ return E_POINTER;
+
+ *context = 0;
+
+ Frame* coreFrame = core(this);
+ if (!coreFrame)
+ return E_FAIL;
+
+ *context = toGlobalRef(coreFrame->scriptProxy()->interpreter()->globalExec());
+ return S_OK;
+}
+
HRESULT STDMETHODCALLTYPE WebFrame::loadRequest(
/* [in] */ IWebURLRequest* request)
{
virtual HRESULT STDMETHODCALLTYPE currentForm(
/* [retval][out] */ IDOMElement **formElement);
+ virtual HRESULT STDMETHODCALLTYPE globalContext(
+ /* [retval][out] */ JSGlobalContextRef* context);
+
// IWebFramePrivate
virtual HRESULT STDMETHODCALLTYPE renderTreeAsExternalRepresentation(
/* [retval][out] */ BSTR *result);