| 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 524 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 // FIXME: Figure out how to cache this helper function. Run a helper fu
nction that collects the properties | 535 // FIXME: Figure out how to cache this helper function. Run a helper fu
nction that collects the properties |
| 536 // on the object into an array. | 536 // on the object into an array. |
| 537 const char enumeratorCode[] = | 537 const char enumeratorCode[] = |
| 538 "(function (obj) {" | 538 "(function (obj) {" |
| 539 " var props = [];" | 539 " var props = [];" |
| 540 " for (var prop in obj) {" | 540 " for (var prop in obj) {" |
| 541 " props[props.length] = prop;" | 541 " props[props.length] = prop;" |
| 542 " }" | 542 " }" |
| 543 " return props;" | 543 " return props;" |
| 544 "});"; | 544 "});"; |
| 545 v8::Handle<v8::String> source = v8::String::NewFromUtf8(isolate, enumera
torCode); | 545 v8::Handle<v8::String> source = v8AtomicString(isolate, enumeratorCode); |
| 546 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScri
pt(source, context->GetIsolate()); | 546 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScri
pt(source, context->GetIsolate()); |
| 547 ASSERT(!result.IsEmpty()); | 547 ASSERT(!result.IsEmpty()); |
| 548 ASSERT(result->IsFunction()); | 548 ASSERT(result->IsFunction()); |
| 549 v8::Handle<v8::Function> enumerator = v8::Handle<v8::Function>::Cast(res
ult); | 549 v8::Handle<v8::Function> enumerator = v8::Handle<v8::Function>::Cast(res
ult); |
| 550 v8::Handle<v8::Value> argv[] = { obj }; | 550 v8::Handle<v8::Value> argv[] = { obj }; |
| 551 v8::Local<v8::Value> propsObj = V8ScriptRunner::callInternalFunction(enu
merator, v8::Handle<v8::Object>::Cast(result), WTF_ARRAY_LENGTH(argv), argv, con
text->GetIsolate()); | 551 v8::Local<v8::Value> propsObj = V8ScriptRunner::callInternalFunction(enu
merator, v8::Handle<v8::Object>::Cast(result), WTF_ARRAY_LENGTH(argv), argv, con
text->GetIsolate()); |
| 552 if (propsObj.IsEmpty()) | 552 if (propsObj.IsEmpty()) |
| 553 return false; | 553 return false; |
| 554 | 554 |
| 555 // Convert the results into an array of NPIdentifiers. | 555 // Convert the results into an array of NPIdentifiers. |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 604 | 604 |
| 605 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate); | 605 convertV8ObjectToNPVariant(resultObject, npObject, result, isolate); |
| 606 return true; | 606 return true; |
| 607 } | 607 } |
| 608 | 608 |
| 609 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) | 609 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) |
| 610 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); | 610 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); |
| 611 | 611 |
| 612 return false; | 612 return false; |
| 613 } | 613 } |
| OLD | NEW |