| 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 * Copyright (C) 2014 Opera Software ASA. All rights reserved. | 4 * Copyright (C) 2014 Opera Software ASA. All rights reserved. |
| 5 * | 5 * |
| 6 * Redistribution and use in source and binary forms, with or without | 6 * Redistribution and use in source and binary forms, with or without |
| 7 * modification, are permitted provided that the following conditions | 7 * modification, are permitted provided that the following conditions |
| 8 * are met: | 8 * are met: |
| 9 * 1. Redistributions of source code must retain the above copyright | 9 * 1. Redistributions of source code must retain the above copyright |
| 10 * notice, this list of conditions and the following disclaimer. | 10 * notice, this list of conditions and the following disclaimer. |
| (...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 548 // on the object into an array. | 548 // on the object into an array. |
| 549 const char enumeratorCode[] = | 549 const char enumeratorCode[] = |
| 550 "(function (obj) {" | 550 "(function (obj) {" |
| 551 " var props = [];" | 551 " var props = [];" |
| 552 " for (var prop in obj) {" | 552 " for (var prop in obj) {" |
| 553 " props[props.length] = prop;" | 553 " props[props.length] = prop;" |
| 554 " }" | 554 " }" |
| 555 " return props;" | 555 " return props;" |
| 556 "});"; | 556 "});"; |
| 557 v8::Handle<v8::String> source = v8AtomicString(isolate, enumeratorCode); | 557 v8::Handle<v8::String> source = v8AtomicString(isolate, enumeratorCode); |
| 558 v8::Handle<v8::Value> result = V8ScriptRunner::compileAndRunInternalScri
pt(source, isolate); | 558 v8::Local<v8::Value> result; |
| 559 ASSERT(!result.IsEmpty()); | 559 if (!V8ScriptRunner::compileAndRunInternalScript(source, isolate).ToLoca
l(&result)) |
| 560 return false; |
| 560 ASSERT(result->IsFunction()); | 561 ASSERT(result->IsFunction()); |
| 561 v8::Handle<v8::Function> enumerator = v8::Handle<v8::Function>::Cast(res
ult); | 562 v8::Handle<v8::Function> enumerator = v8::Handle<v8::Function>::Cast(res
ult); |
| 562 v8::Handle<v8::Value> argv[] = { obj }; | 563 v8::Handle<v8::Value> argv[] = { obj }; |
| 563 v8::Local<v8::Value> propsObj = V8ScriptRunner::callInternalFunction(enu
merator, v8::Handle<v8::Object>::Cast(result), WTF_ARRAY_LENGTH(argv), argv, iso
late); | 564 v8::Local<v8::Value> propsObj = V8ScriptRunner::callInternalFunction(enu
merator, v8::Handle<v8::Object>::Cast(result), WTF_ARRAY_LENGTH(argv), argv, iso
late); |
| 564 if (propsObj.IsEmpty()) | 565 if (propsObj.IsEmpty()) |
| 565 return false; | 566 return false; |
| 566 | 567 |
| 567 // Convert the results into an array of NPIdentifiers. | 568 // Convert the results into an array of NPIdentifiers. |
| 568 v8::Handle<v8::Array> props = v8::Handle<v8::Array>::Cast(propsObj); | 569 v8::Handle<v8::Array> props = v8::Handle<v8::Array>::Cast(propsObj); |
| 569 *count = props->Length(); | 570 *count = props->Length(); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 | 616 |
| 616 convertV8ObjectToNPVariant(isolate, resultObject, npObject, result); | 617 convertV8ObjectToNPVariant(isolate, resultObject, npObject, result); |
| 617 return true; | 618 return true; |
| 618 } | 619 } |
| 619 | 620 |
| 620 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) | 621 if (NP_CLASS_STRUCT_VERSION_HAS_CTOR(npObject->_class) && npObject->_class->
construct) |
| 621 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); | 622 return npObject->_class->construct(npObject, arguments, argumentCount, r
esult); |
| 622 | 623 |
| 623 return false; | 624 return false; |
| 624 } | 625 } |
| OLD | NEW |