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 24269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24280 CHECK_NE(*object->Get(env2.local(), v8_str("values")).ToLocalChecked(), | 24280 CHECK_NE(*object->Get(env2.local(), v8_str("values")).ToLocalChecked(), |
24281 *object2->Get(env2.local(), v8_str("values")).ToLocalChecked()); | 24281 *object2->Get(env2.local(), v8_str("values")).ToLocalChecked()); |
24282 | 24282 |
24283 auto values2 = Local<Function>::Cast( | 24283 auto values2 = Local<Function>::Cast( |
24284 object2->Get(env2.local(), v8_str("values")).ToLocalChecked()); | 24284 object2->Get(env2.local(), v8_str("values")).ToLocalChecked()); |
24285 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); | 24285 auto fn2 = i::Handle<i::JSFunction>::cast(v8::Utils::OpenHandle(*values2)); |
24286 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); | 24286 auto ctx2 = v8::Utils::OpenHandle(*env2.local()); |
24287 CHECK_EQ(fn2->GetCreationContext(), *ctx2); | 24287 CHECK_EQ(fn2->GetCreationContext(), *ctx2); |
24288 } | 24288 } |
24289 } | 24289 } |
| 24290 |
| 24291 |
| 24292 TEST(Proxy) { |
| 24293 i::FLAG_harmony_proxies = true; |
| 24294 LocalContext context; |
| 24295 v8::Isolate* isolate = CcTest::isolate(); |
| 24296 v8::HandleScope scope(isolate); |
| 24297 v8::Local<v8::Object> target = CompileRun("({})").As<v8::Object>(); |
| 24298 v8::Local<v8::Object> handler = CompileRun("({})").As<v8::Object>(); |
| 24299 |
| 24300 v8::Local<v8::Proxy> proxy = |
| 24301 v8::Proxy::New(context.local(), target, handler).ToLocalChecked(); |
| 24302 CHECK(proxy->IsProxy()); |
| 24303 CHECK(!target->IsProxy()); |
| 24304 CHECK(!proxy->IsRevoked()); |
| 24305 CHECK(proxy->GetTarget()->SameValue(target)); |
| 24306 CHECK(proxy->GetHandler()->SameValue(handler)); |
| 24307 |
| 24308 proxy->Revoke(); |
| 24309 CHECK(proxy->IsProxy()); |
| 24310 CHECK(!target->IsProxy()); |
| 24311 CHECK(proxy->IsRevoked()); |
| 24312 CHECK(proxy->GetTarget()->SameValue(target)); |
| 24313 CHECK(proxy->GetHandler()->IsNull()); |
| 24314 } |
OLD | NEW |