<rdar://problem/7879485> Leopard: Crash after opening Software Update dialog
[WebKit-https.git] / JavaScriptGlue / JSUtils.h
index 470c68c..cbd9912 100644 (file)
 
 #include "JavaScriptGlue.h"
 
-#include <JavaScriptCore/value.h>
-#include <JavaScriptCore/object.h>
-#include <JavaScriptCore/types.h>
-#include <JavaScriptCore/interpreter.h>
-#include <JavaScriptCore/protect.h>
-#include <JavaScriptCore/collector.h>
-#include <JavaScriptCore/ustring.h>
+#include <JavaScriptCore/Collector.h>
+#include <JavaScriptCore/JSValue.h>
+#include <JavaScriptCore/Completion.h>
+#include <JavaScriptCore/Identifier.h>
+#include <JavaScriptCore/JSLock.h>
+#include <JavaScriptCore/JSObject.h>
+#include <JavaScriptCore/JSGlobalObject.h>
+#include <JavaScriptCore/Protect.h>
+#include <JavaScriptCore/UString.h>
 
 #include <wtf/RefPtr.h>
 
-using namespace KJS;
+using namespace JSC;
 
 class JSBase;
 class JSUserObject;
@@ -51,16 +53,18 @@ class JSUserObjectImp;
 
 UString CFStringToUString(CFStringRef inCFString);
 CFStringRef UStringToCFString(const UString& inUString);
-Identifier CFStringToIdentifier(CFStringRef inCFString);
+Identifier CFStringToIdentifier(CFStringRef inCFString, ExecState*);
 CFStringRef IdentifierToCFString(const Identifier& inIdentifier);
-JSUserObject *KJSValueToJSObject(JSValue *inValue, ExecState *exec);
-CFTypeRef KJSValueToCFType(JSValue *inValue, ExecState *exec);
-JSValue *JSObjectKJSValue(JSUserObject* ptr);
+JSUserObject *KJSValueToJSObject(JSValue inValue, ExecState *exec);
+CFTypeRef KJSValueToCFType(JSValue inValue, ExecState *exec);
+JSValue JSObjectKJSValue(JSUserObject* ptr);
 CFTypeRef GetCFNull(void);
 
 inline CFTypeRef RetainCFType(CFTypeRef x) { if (x) x = CFRetain(x); return x; }
 inline void ReleaseCFType(CFTypeRef x) { if (x) CFRelease(x);  }
 
+ExecState* getThreadGlobalExecState();
+
 enum {
     kJSInvalidTypeID = 0,
     kJSObjectTypeID,
@@ -73,5 +77,24 @@ enum {
     kJSUserObjectDataTypeCFType
 };
 
+class JSGlueAPIEntry {
+public:
+    JSGlueAPIEntry();
+    JSGlueAPIEntry(JSGlobalObject*); // For use when it's not safe for JSGlueAPIEntry() to call getThreadGlobalObject() -- for example, from a thread-specific data destructor.
+    ~JSGlueAPIEntry();
+
+private:
+    JSLock m_lock;
+    IdentifierTable* m_storedIdentifierTable;
+};
+
+class JSGlueAPICallback {
+public:
+    JSGlueAPICallback(ExecState*);
+    ~JSGlueAPICallback();
+
+private:
+    JSLock::DropAllLocks m_dropLocks;
+};
 
 #endif