diff options
Diffstat (limited to 'WebCore/bindings/v8/V8NPUtils.h')
-rw-r--r-- | WebCore/bindings/v8/V8NPUtils.h | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/WebCore/bindings/v8/V8NPUtils.h b/WebCore/bindings/v8/V8NPUtils.h index c978d2b..78414b4 100644 --- a/WebCore/bindings/v8/V8NPUtils.h +++ b/WebCore/bindings/v8/V8NPUtils.h @@ -38,6 +38,8 @@ #include <v8.h> +namespace WebCore { + // Convert a V8 Value of any type (string, bool, object, etc) to a NPVariant. void convertV8ObjectToNPVariant(v8::Local<v8::Value>, NPObject*, NPVariant*); @@ -48,4 +50,22 @@ v8::Handle<v8::Value> convertNPVariantToV8Object(const NPVariant*, NPObject*); // Helper function to create an NPN String Identifier from a v8 string. NPIdentifier getStringIdentifier(v8::Handle<v8::String>); +// The ExceptionHandler will be notified of any exceptions thrown while +// operating on a NPObject. +typedef void (*ExceptionHandler)(void* data, const NPUTF8* message); +void pushExceptionHandler(ExceptionHandler, void* data); +void popExceptionHandler(); + +// Upon destruction, an ExceptionCatcher will pass a caught exception to the +// current ExceptionHandler. +class ExceptionCatcher { +public: + ExceptionCatcher(); + ~ExceptionCatcher(); +private: + v8::TryCatch m_tryCatch; +}; + +} // namespace WebCore + #endif // V8NPUtils_h |