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 13 matching lines...) Expand all Loading... |
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
25 */ | 25 */ |
26 | 26 |
27 #include "config.h" | 27 #include "config.h" |
28 | 28 |
29 #include "NPV8Object.h" | 29 #include "NPV8Object.h" |
30 | 30 |
31 #include "PlatformSupport.h" | 31 #include "PlatformSupport.h" |
32 #include "DOMWindow.h" | 32 #include "DOMWindow.h" |
33 #include "Frame.h" | 33 #include "Frame.h" |
| 34 #include "NPObjectWrapper.h" |
34 #include "OwnArrayPtr.h" | 35 #include "OwnArrayPtr.h" |
35 #include "PlatformString.h" | 36 #include "PlatformString.h" |
36 #include "ScriptSourceCode.h" | 37 #include "ScriptSourceCode.h" |
37 #include "UserGestureIndicator.h" | 38 #include "UserGestureIndicator.h" |
38 #include "V8GCController.h" | 39 #include "V8GCController.h" |
39 #include "V8Helpers.h" | 40 #include "V8Helpers.h" |
40 #include "V8NPUtils.h" | 41 #include "V8NPUtils.h" |
41 #include "V8Proxy.h" | 42 #include "V8Proxy.h" |
42 #include "WrapperTypeInfo.h" | 43 #include "WrapperTypeInfo.h" |
43 #include "npruntime_impl.h" | 44 #include "npruntime_impl.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
276 bool popupsAllowed = PlatformSupport::popupsAllowed(npp); | 277 bool popupsAllowed = PlatformSupport::popupsAllowed(npp); |
277 return _NPN_EvaluateHelper(npp, popupsAllowed, npObject, npScript, result); | 278 return _NPN_EvaluateHelper(npp, popupsAllowed, npObject, npScript, result); |
278 } | 279 } |
279 | 280 |
280 bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri
ng* npScript, NPVariant* result) | 281 bool _NPN_EvaluateHelper(NPP npp, bool popupsAllowed, NPObject* npObject, NPStri
ng* npScript, NPVariant* result) |
281 { | 282 { |
282 VOID_TO_NPVARIANT(*result); | 283 VOID_TO_NPVARIANT(*result); |
283 if (!npObject) | 284 if (!npObject) |
284 return false; | 285 return false; |
285 | 286 |
286 if (npObject->_class != npScriptObjectClass) | 287 if (npObject->_class != npScriptObjectClass) { |
287 return false; | 288 // Check if the object passed in is wrapped. If yes, then we need to inv
oke on the underlying object. |
| 289 NPObject* actualObject = NPObjectWrapper::getUnderlyingNPObject(npObject
); |
| 290 if (!actualObject) |
| 291 return false; |
| 292 npObject = actualObject; |
| 293 } |
288 | 294 |
289 v8::HandleScope handleScope; | 295 v8::HandleScope handleScope; |
290 v8::Handle<v8::Context> context = toV8Context(npp, npObject); | 296 v8::Handle<v8::Context> context = toV8Context(npp, npObject); |
291 if (context.IsEmpty()) | 297 if (context.IsEmpty()) |
292 return false; | 298 return false; |
293 | 299 |
294 V8Proxy* proxy = toV8Proxy(npObject); | 300 V8Proxy* proxy = toV8Proxy(npObject); |
295 ASSERT(proxy); | 301 ASSERT(proxy); |
296 | 302 |
297 v8::Context::Scope scope(context); | 303 v8::Context::Scope scope(context); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
558 | 564 |
559 convertV8ObjectToNPVariant(resultObject, npObject, result); | 565 convertV8ObjectToNPVariant(resultObject, npObject, result); |
560 return true; | 566 return true; |
561 } | 567 } |
562 | 568 |
563 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) | 569 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) |
564 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); | 570 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); |
565 | 571 |
566 return false; | 572 return false; |
567 } | 573 } |
OLD | NEW |