diff options
author | plesner@google.com <plesner@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 12:32:42 +0000 |
---|---|---|
committer | plesner@google.com <plesner@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-12 12:32:42 +0000 |
commit | 1efd74d2f540a6d9ac77bbedd530871bfb3765bc (patch) | |
tree | 287a07a7eb544eaebfdf29b591ac3a8c8a953ce1 /webkit/port/bindings/v8 | |
parent | cc2734044c6c94e19f853715cbd5b6abb9098fd8 (diff) | |
download | chromium_src-1efd74d2f540a6d9ac77bbedd530871bfb3765bc.zip chromium_src-1efd74d2f540a6d9ac77bbedd530871bfb3765bc.tar.gz chromium_src-1efd74d2f540a6d9ac77bbedd530871bfb3765bc.tar.bz2 |
Added type check to SVG operation arguments.
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15847 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/port/bindings/v8')
-rw-r--r-- | webkit/port/bindings/v8/V8SVGPODTypeWrapper.h | 24 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.cpp | 8 | ||||
-rw-r--r-- | webkit/port/bindings/v8/v8_proxy.h | 3 |
3 files changed, 35 insertions, 0 deletions
diff --git a/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h b/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h index 79553c2..0fb1fb8 100644 --- a/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h +++ b/webkit/port/bindings/v8/V8SVGPODTypeWrapper.h @@ -36,6 +36,7 @@ #include <wtf/Assertions.h> #include <wtf/RefCounted.h> #include <wtf/HashMap.h> +#include "v8_proxy.h" namespace WebCore { @@ -357,6 +358,29 @@ public: }; +class V8SVGPODTypeUtil { +public: + template <class P> + static P ToSVGPODType(V8ClassIndex::V8WrapperType type, + v8::Handle<v8::Value> object, bool& ok); +}; + + +template <class P> +P V8SVGPODTypeUtil::ToSVGPODType(V8ClassIndex::V8WrapperType type, + v8::Handle<v8::Value> object, + bool& ok) { + void *wrapper = V8Proxy::ToSVGPODTypeImpl(type, object); + if (wrapper == NULL) { + ok = false; + return P(); + } else { + ok = true; + return *static_cast<V8SVGPODTypeWrapper<P>*>(wrapper); + } +} + + } // namespace WebCore #endif // ENABLE(SVG) diff --git a/webkit/port/bindings/v8/v8_proxy.cpp b/webkit/port/bindings/v8/v8_proxy.cpp index 8413219..161658a 100644 --- a/webkit/port/bindings/v8/v8_proxy.cpp +++ b/webkit/port/bindings/v8/v8_proxy.cpp @@ -2420,6 +2420,14 @@ void* V8Proxy::ToNativeObjectImpl(V8ClassIndex::V8WrapperType type, } +void* V8Proxy::ToSVGPODTypeImpl(V8ClassIndex::V8WrapperType type, + v8::Handle<v8::Value> object) { + return IsWrapperOfType(object, type) + ? DOMWrapperToNative<void>(object) + : NULL; +} + + v8::Handle<v8::Object> V8Proxy::LookupDOMWrapper( V8ClassIndex::V8WrapperType type, v8::Handle<v8::Value> value) { diff --git a/webkit/port/bindings/v8/v8_proxy.h b/webkit/port/bindings/v8/v8_proxy.h index ea32708..4cb6892 100644 --- a/webkit/port/bindings/v8/v8_proxy.h +++ b/webkit/port/bindings/v8/v8_proxy.h @@ -476,6 +476,9 @@ class V8Proxy { static void RegisterExtension(v8::Extension* extension, const String& schemeRestriction); + static void* ToSVGPODTypeImpl(V8ClassIndex::V8WrapperType type, + v8::Handle<v8::Value> object); + private: v8::Persistent<v8::Context> createNewContext(v8::Handle<v8::Object> global); void InitContextIfNeeded(); |