Chromium Code Reviews| 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 13611 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 13622 v8::Handle<v8::Function> define_property = | 13622 v8::Handle<v8::Function> define_property = |
| 13623 CompileRun("(function() {" | 13623 CompileRun("(function() {" |
| 13624 " Object.defineProperty(" | 13624 " Object.defineProperty(" |
| 13625 " this," | 13625 " this," |
| 13626 " 1," | 13626 " 1," |
| 13627 " { configurable: true, enumerable: true, value: 3 });" | 13627 " { configurable: true, enumerable: true, value: 3 });" |
| 13628 "})").As<Function>(); | 13628 "})").As<Function>(); |
| 13629 context->DetachGlobal(); | 13629 context->DetachGlobal(); |
| 13630 define_property->Call(proxy, 0, NULL); | 13630 define_property->Call(proxy, 0, NULL); |
| 13631 } | 13631 } |
| 13632 | |
| 13633 | |
| 13634 THREADED_TEST(CreationContext) { | |
|
Mads Ager (chromium)
2011/04/01 11:19:38
Would be nice to extend this test with stuff creat
antonm
2011/04/01 12:15:46
Done. I'll add more if you think it's still not e
| |
| 13635 HandleScope handle_scope; | |
| 13636 Persistent<Context> context1 = Context::New(); | |
| 13637 Persistent<Context> context2 = Context::New(); | |
| 13638 | |
| 13639 Local<Object> object1; | |
| 13640 { | |
| 13641 Context::Scope scope(context1); | |
| 13642 object1 = Object::New(); | |
| 13643 } | |
| 13644 | |
| 13645 Local<Object> object2; | |
| 13646 { | |
| 13647 Context::Scope scope(context2); | |
| 13648 object2 = Object::New(); | |
| 13649 } | |
| 13650 | |
| 13651 CHECK(object1->CreationContext() == context1); | |
| 13652 CHECK(object2->CreationContext() == context2); | |
| 13653 | |
| 13654 { | |
| 13655 Context::Scope scope(context1); | |
| 13656 CHECK(object1->CreationContext() == context1); | |
| 13657 CHECK(object2->CreationContext() == context2); | |
| 13658 } | |
| 13659 | |
| 13660 { | |
| 13661 Context::Scope scope(context2); | |
| 13662 CHECK(object1->CreationContext() == context1); | |
| 13663 CHECK(object2->CreationContext() == context2); | |
| 13664 } | |
| 13665 | |
| 13666 context1.Dispose(); | |
| 13667 context2.Dispose(); | |
| 13668 } | |
| OLD | NEW |