summaryrefslogtreecommitdiffstats
path: root/WebCore/bindings/v8/NPV8Object.cpp
diff options
context:
space:
mode:
authorSteve Block <steveblock@google.com>2010-04-27 16:31:00 +0100
committerSteve Block <steveblock@google.com>2010-05-11 14:42:12 +0100
commitdcc8cf2e65d1aa555cce12431a16547e66b469ee (patch)
tree92a8d65cd5383bca9749f5327fb5e440563926e6 /WebCore/bindings/v8/NPV8Object.cpp
parentccac38a6b48843126402088a309597e682f40fe6 (diff)
downloadexternal_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.zip
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.gz
external_webkit-dcc8cf2e65d1aa555cce12431a16547e66b469ee.tar.bz2
Merge webkit.org at r58033 : Initial merge by git
Change-Id: If006c38561af287c50cd578d251629b51e4d8cd1
Diffstat (limited to 'WebCore/bindings/v8/NPV8Object.cpp')
-rw-r--r--WebCore/bindings/v8/NPV8Object.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/WebCore/bindings/v8/NPV8Object.cpp b/WebCore/bindings/v8/NPV8Object.cpp
index 06243d4..56f9810 100644
--- a/WebCore/bindings/v8/NPV8Object.cpp
+++ b/WebCore/bindings/v8/NPV8Object.cpp
@@ -36,9 +36,9 @@
#include "ScriptController.h"
#include "V8GCController.h"
#include "V8Helpers.h"
-#include "V8Index.h"
#include "V8NPUtils.h"
#include "V8Proxy.h"
+#include "WrapperTypeInfo.h"
#include "npruntime_impl.h"
#include "npruntime_priv.h"
@@ -55,10 +55,20 @@
using WebCore::npObjectInternalFieldCount;
using WebCore::toV8Context;
using WebCore::toV8Proxy;
-using WebCore::V8ClassIndex;
using WebCore::V8DOMWrapper;
using WebCore::V8GCController;
using WebCore::V8Proxy;
+using WebCore::WrapperTypeInfo;
+
+namespace WebCore {
+
+WrapperTypeInfo* npObjectTypeInfo()
+{
+ static WrapperTypeInfo typeInfo = { 0, 0, false };
+ return &typeInfo;
+}
+
+}
// FIXME: Comments on why use malloc and free.
static NPObject* allocV8NPObject(NPP, NPClass*)
@@ -115,8 +125,8 @@ NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, WebCore
{
// Check to see if this object is already wrapped.
if (object->InternalFieldCount() == npObjectInternalFieldCount) {
- v8::Local<v8::Value> typeIndex = object->GetInternalField(WebCore::v8DOMWrapperTypeIndex);
- if (typeIndex->IsNumber() && typeIndex->Uint32Value() == V8ClassIndex::NPOBJECT) {
+ WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetPointerFromInternalField(WebCore::v8DOMWrapperTypeIndex));
+ if (typeInfo == WebCore::npObjectTypeInfo()) {
NPObject* returnValue = v8ObjectToNPObject(object);
_NPN_RetainObject(returnValue);
@@ -299,6 +309,9 @@ bool _NPN_GetProperty(NPP npp, NPObject* npObject, NPIdentifier propertyName, NP
v8::Handle<v8::Object> obj(object->v8Object);
v8::Local<v8::Value> v8result = obj->Get(npIdentifierToV8Identifier(propertyName));
+
+ if (v8result.IsEmpty())
+ return false;
convertV8ObjectToNPVariant(v8result, npObject, result);
return true;