| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. | 2 * Copyright (C) 2004, 2006 Apple Computer, Inc. All rights reserved. |
| 3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. | 3 * Copyright (C) 2007, 2008, 2009 Google, Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 104 if (identifier->isString) | 104 if (identifier->isString) |
| 105 return v8::String::NewSymbol(static_cast<const char*>(identifier->value.
string)); | 105 return v8::String::NewSymbol(static_cast<const char*>(identifier->value.
string)); |
| 106 | 106 |
| 107 char buffer[32]; | 107 char buffer[32]; |
| 108 snprintf(buffer, sizeof(buffer), "%d", identifier->value.number); | 108 snprintf(buffer, sizeof(buffer), "%d", identifier->value.number); |
| 109 return v8::String::NewSymbol(buffer); | 109 return v8::String::NewSymbol(buffer); |
| 110 } | 110 } |
| 111 | 111 |
| 112 NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object) | 112 NPObject* v8ObjectToNPObject(v8::Handle<v8::Object> object) |
| 113 { | 113 { |
| 114 return reinterpret_cast<NPObject*>(object->GetAlignedPointerFromInternalFiel
d(v8DOMWrapperObjectIndex)); | 114 return reinterpret_cast<NPObject*>(object->GetAlignedPointerFromInternalFiel
d(v8DOMWrapperObjectIndex)); |
| 115 } | 115 } |
| 116 | 116 |
| 117 NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWind
ow* root) | 117 NPObject* npCreateV8ScriptObject(NPP npp, v8::Handle<v8::Object> object, DOMWind
ow* root) |
| 118 { | 118 { |
| 119 // Check to see if this object is already wrapped. | 119 // Check to see if this object is already wrapped. |
| 120 if (object->InternalFieldCount() == npObjectInternalFieldCount) { | 120 if (object->InternalFieldCount() == npObjectInternalFieldCount) { |
| 121 WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetAli
gnedPointerFromInternalField(v8DOMWrapperTypeIndex)); | 121 WrapperTypeInfo* typeInfo = static_cast<WrapperTypeInfo*>(object->GetAli
gnedPointerFromInternalField(v8DOMWrapperTypeIndex)); |
| 122 if (typeInfo == npObjectTypeInfo()) { | 122 if (typeInfo == npObjectTypeInfo()) { |
| 123 NPObject* returnValue = v8ObjectToNPObject(object); | 123 NPObject* returnValue = v8ObjectToNPObject(object); |
| 124 _NPN_RetainObject(returnValue); | 124 _NPN_RetainObject(returnValue); |
| (...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 375 v8::HandleScope handleScope(isolate); | 375 v8::HandleScope handleScope(isolate); |
| 376 v8::Handle<v8::Context> context = toV8Context(npp, npObject); | 376 v8::Handle<v8::Context> context = toV8Context(npp, npObject); |
| 377 if (context.IsEmpty()) | 377 if (context.IsEmpty()) |
| 378 return false; | 378 return false; |
| 379 | 379 |
| 380 v8::Context::Scope scope(context); | 380 v8::Context::Scope scope(context); |
| 381 ExceptionCatcher exceptionCatcher; | 381 ExceptionCatcher exceptionCatcher; |
| 382 | 382 |
| 383 v8::Handle<v8::Object> obj = v8::Local<v8::Object>::New(isolate, object-
>v8Object); | 383 v8::Handle<v8::Object> obj = v8::Local<v8::Object>::New(isolate, object-
>v8Object); |
| 384 v8::Local<v8::Value> v8result = obj->Get(npIdentifierToV8Identifier(prop
ertyName)); | 384 v8::Local<v8::Value> v8result = obj->Get(npIdentifierToV8Identifier(prop
ertyName)); |
| 385 | 385 |
| 386 if (v8result.IsEmpty()) | 386 if (v8result.IsEmpty()) |
| 387 return false; | 387 return false; |
| 388 | 388 |
| 389 convertV8ObjectToNPVariant(v8result, npObject, result); | 389 convertV8ObjectToNPVariant(v8result, npObject, result); |
| 390 return true; | 390 return true; |
| 391 } | 391 } |
| 392 | 392 |
| 393 if (npObject->_class->hasProperty && npObject->_class->getProperty) { | 393 if (npObject->_class->hasProperty && npObject->_class->getProperty) { |
| 394 if (npObject->_class->hasProperty(npObject, propertyName)) | 394 if (npObject->_class->hasProperty(npObject, propertyName)) |
| 395 return npObject->_class->getProperty(npObject, propertyName, result)
; | 395 return npObject->_class->getProperty(npObject, propertyName, result)
; |
| (...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 605 | 605 |
| 606 convertV8ObjectToNPVariant(resultObject, npObject, result); | 606 convertV8ObjectToNPVariant(resultObject, npObject, result); |
| 607 return true; | 607 return true; |
| 608 } | 608 } |
| 609 | 609 |
| 610 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) | 610 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) |
| 611 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); | 611 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); |
| 612 | 612 |
| 613 return false; | 613 return false; |
| 614 } | 614 } |
| OLD | NEW |