Index: Source/bindings/core/v8/NPV8Object.cpp |
diff --git a/Source/bindings/core/v8/NPV8Object.cpp b/Source/bindings/core/v8/NPV8Object.cpp |
index 03c689b879c7969f73321cb9a9a6e8bfb971aaf8..164f463ef6e14462cc6024689ba2efc0e1e632b8 100644 |
--- a/Source/bindings/core/v8/NPV8Object.cpp |
+++ b/Source/bindings/core/v8/NPV8Object.cpp |
@@ -1,6 +1,7 @@ |
/* |
* Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. |
* Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. |
+ * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
* |
* Redistribution and use in source and binary forms, with or without |
* modification, are permitted provided that the following conditions |
@@ -114,16 +115,22 @@ NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object) |
return reinterpret_cast<NPObject*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperObjectIndex)); |
} |
-NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, LocalDOMWindow* root, v8::Isolate* isolate) |
+bool isWrappedNPObject(v8::Handle<v8::Object> object) |
{ |
- // Check to see if this object is already wrapped. |
if (object->InternalFieldCount() == npObjectInternalFieldCount) { |
const WrapperTypeInfo* typeInfo = static_cast<const WrapperTypeInfo*>(object->GetAlignedPointerFromInternalField(v8DOMWrapperTypeIndex)); |
- if (typeInfo == npObjectTypeInfo()) { |
- NPObject* returnValue = v8ObjectToNPObject(object); |
- _NPN_RetainObject(returnValue); |
- return returnValue; |
- } |
+ return typeInfo == npObjectTypeInfo(); |
+ } |
+ return false; |
+} |
+ |
+NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, LocalDOMWindow* root, v8::Isolate* isolate) |
+{ |
+ // Check to see if this object is already wrapped. |
+ if (isWrappedNPObject(object)) { |
+ NPObject* returnValue = v8ObjectToNPObject(object); |
+ _NPN_RetainObject(returnValue); |
+ return returnValue; |
} |
V8NPObjectVector* objectVector = 0; |