| OLD | NEW |
| 1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 the V8 project authors. All rights reserved. |
| 2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
| 3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
| 4 // met: | 4 // met: |
| 5 // | 5 // |
| 6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
| 7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
| 8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
| 9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
| 10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
| (...skipping 13750 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13761 } | 13761 } |
| 13762 | 13762 |
| 13763 | 13763 |
| 13764 static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo& info) { | 13764 static v8::Handle<v8::Array> Enumerator(const v8::AccessorInfo& info) { |
| 13765 v8::Handle<v8::Array> result = v8::Array::New(); | 13765 v8::Handle<v8::Array> result = v8::Array::New(); |
| 13766 result->Set(0, v8_str("universalAnswer")); | 13766 result->Set(0, v8_str("universalAnswer")); |
| 13767 return result; | 13767 return result; |
| 13768 } | 13768 } |
| 13769 | 13769 |
| 13770 | 13770 |
| 13771 static Handle<Value> getter1330(Local<String> property, |
| 13772 const AccessorInfo& info) { |
| 13773 return ThrowException(v8_str("Error")); |
| 13774 } |
| 13775 |
| 13776 |
| 13777 THREADED_TEST(Regression1330) { |
| 13778 HandleScope scope; |
| 13779 LocalContext context; |
| 13780 |
| 13781 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
| 13782 templ->SetNamedPropertyHandler(getter1330); |
| 13783 Local<Object> instance = templ->NewInstance(); |
| 13784 Local<Value> result = instance->Get(v8_str("foo")); |
| 13785 CHECK(result.IsEmpty()); |
| 13786 } |
| 13787 |
| 13788 |
| 13771 TEST(NamedEnumeratorAndForIn) { | 13789 TEST(NamedEnumeratorAndForIn) { |
| 13772 v8::HandleScope handle_scope; | 13790 v8::HandleScope handle_scope; |
| 13773 LocalContext context; | 13791 LocalContext context; |
| 13774 v8::Context::Scope context_scope(context.local()); | 13792 v8::Context::Scope context_scope(context.local()); |
| 13775 | 13793 |
| 13776 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); | 13794 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); |
| 13777 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); | 13795 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); |
| 13778 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); | 13796 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); |
| 13779 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( | 13797 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( |
| 13780 "var result = []; for (var k in o) result.push(k); result")); | 13798 "var result = []; for (var k in o) result.push(k); result")); |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 13889 CHECK(func2->CreationContext() == context2); | 13907 CHECK(func2->CreationContext() == context2); |
| 13890 CheckContextId(func2, 2); | 13908 CheckContextId(func2, 2); |
| 13891 CHECK(instance2->CreationContext() == context2); | 13909 CHECK(instance2->CreationContext() == context2); |
| 13892 CheckContextId(instance2, 2); | 13910 CheckContextId(instance2, 2); |
| 13893 } | 13911 } |
| 13894 | 13912 |
| 13895 context1.Dispose(); | 13913 context1.Dispose(); |
| 13896 context2.Dispose(); | 13914 context2.Dispose(); |
| 13897 context3.Dispose(); | 13915 context3.Dispose(); |
| 13898 } | 13916 } |
| OLD | NEW |