OLD | NEW |
---|---|
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 12531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
12542 v8::Context::Scope context_scope(context.local()); | 12542 v8::Context::Scope context_scope(context.local()); |
12543 | 12543 |
12544 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); | 12544 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); |
12545 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); | 12545 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); |
12546 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); | 12546 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); |
12547 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( | 12547 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( |
12548 "var result = []; for (var k in o) result.push(k); result")); | 12548 "var result = []; for (var k in o) result.push(k); result")); |
12549 CHECK_EQ(1, result->Length()); | 12549 CHECK_EQ(1, result->Length()); |
12550 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); | 12550 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); |
12551 } | 12551 } |
12552 | |
12553 | |
12554 TEST(DefinePropertyPostDetach) { | |
12555 v8::HandleScope scope; | |
12556 LocalContext context; | |
12557 v8::Handle<v8::Object> proxy = context->Global(); | |
12558 v8::Handle<v8::Function> define_property = | |
12559 CompileRun("(function() {" | |
12560 " Object.defineProperty(" | |
12561 " this," | |
12562 " 1," | |
12563 " { configurable: true, defineProperty: true, value: 3 });" | |
Rico
2011/02/08 14:23:46
a descriptor does not normally have a defineProper
Mads Ager (chromium)
2011/02/08 16:30:18
Done.
| |
12564 "})").As<Function>(); | |
12565 context->DetachGlobal(); | |
12566 define_property->Call(proxy, 0, NULL); | |
12567 } | |
OLD | NEW |