| OLD | NEW |
| 1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 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 19628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 19639 function = CompileRun("function foo() {}; foo").As<Object>(); | 19639 function = CompileRun("function foo() {}; foo").As<Object>(); |
| 19640 } | 19640 } |
| 19641 | 19641 |
| 19642 Local<Context> other_context = Context::New(CcTest::isolate()); | 19642 Local<Context> other_context = Context::New(CcTest::isolate()); |
| 19643 Context::Scope scope(other_context); | 19643 Context::Scope scope(other_context); |
| 19644 CHECK(function->CreationContext() == context); | 19644 CHECK(function->CreationContext() == context); |
| 19645 CheckContextId(function, 1); | 19645 CheckContextId(function, 1); |
| 19646 } | 19646 } |
| 19647 | 19647 |
| 19648 | 19648 |
| 19649 THREADED_TEST(CreationContextOfJsBoundFunction) { | |
| 19650 HandleScope handle_scope(CcTest::isolate()); | |
| 19651 Local<Context> context1 = Context::New(CcTest::isolate()); | |
| 19652 InstallContextId(context1, 1); | |
| 19653 Local<Context> context2 = Context::New(CcTest::isolate()); | |
| 19654 InstallContextId(context2, 2); | |
| 19655 | |
| 19656 Local<Function> target_function; | |
| 19657 { | |
| 19658 Context::Scope scope(context1); | |
| 19659 target_function = CompileRun("function foo() {}; foo").As<Function>(); | |
| 19660 } | |
| 19661 | |
| 19662 Local<Function> bound_function1, bound_function2; | |
| 19663 { | |
| 19664 Context::Scope scope(context2); | |
| 19665 CHECK(context2->Global() | |
| 19666 ->Set(context2, v8_str("foo"), target_function) | |
| 19667 .FromJust()); | |
| 19668 bound_function1 = CompileRun("foo.bind(1)").As<Function>(); | |
| 19669 bound_function2 = | |
| 19670 CompileRun("Function.prototype.bind.call(foo, 2)").As<Function>(); | |
| 19671 } | |
| 19672 | |
| 19673 Local<Context> other_context = Context::New(CcTest::isolate()); | |
| 19674 Context::Scope scope(other_context); | |
| 19675 CHECK(bound_function1->CreationContext() == context1); | |
| 19676 CheckContextId(bound_function1, 1); | |
| 19677 CHECK(bound_function2->CreationContext() == context2); | |
| 19678 CheckContextId(bound_function2, 1); | |
| 19679 } | |
| 19680 | |
| 19681 | |
| 19682 void HasOwnPropertyIndexedPropertyGetter( | 19649 void HasOwnPropertyIndexedPropertyGetter( |
| 19683 uint32_t index, | 19650 uint32_t index, |
| 19684 const v8::PropertyCallbackInfo<v8::Value>& info) { | 19651 const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 19685 if (index == 42) info.GetReturnValue().Set(v8_str("yes")); | 19652 if (index == 42) info.GetReturnValue().Set(v8_str("yes")); |
| 19686 } | 19653 } |
| 19687 | 19654 |
| 19688 | 19655 |
| 19689 void HasOwnPropertyNamedPropertyGetter( | 19656 void HasOwnPropertyNamedPropertyGetter( |
| 19690 Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { | 19657 Local<Name> property, const v8::PropertyCallbackInfo<v8::Value>& info) { |
| 19691 if (property->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("foo")) | 19658 if (property->Equals(info.GetIsolate()->GetCurrentContext(), v8_str("foo")) |
| (...skipping 4646 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 24338 CHECK(proxy->GetTarget()->SameValue(target)); | 24305 CHECK(proxy->GetTarget()->SameValue(target)); |
| 24339 CHECK(proxy->GetHandler()->SameValue(handler)); | 24306 CHECK(proxy->GetHandler()->SameValue(handler)); |
| 24340 | 24307 |
| 24341 proxy->Revoke(); | 24308 proxy->Revoke(); |
| 24342 CHECK(proxy->IsProxy()); | 24309 CHECK(proxy->IsProxy()); |
| 24343 CHECK(!target->IsProxy()); | 24310 CHECK(!target->IsProxy()); |
| 24344 CHECK(proxy->IsRevoked()); | 24311 CHECK(proxy->IsRevoked()); |
| 24345 CHECK(proxy->GetTarget()->SameValue(target)); | 24312 CHECK(proxy->GetTarget()->SameValue(target)); |
| 24346 CHECK(proxy->GetHandler()->IsNull()); | 24313 CHECK(proxy->GetHandler()->IsNull()); |
| 24347 } | 24314 } |
| OLD | NEW |