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 24435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24446 { | 24446 { |
24447 v8::TryCatch try_catch(isolate); | 24447 v8::TryCatch try_catch(isolate); |
24448 v8::Local<Value> args[] = {v8_num(42), v8_num(555)}; | 24448 v8::Local<Value> args[] = {v8_num(42), v8_num(555)}; |
24449 fun->Call(env.local(), v8::Undefined(isolate), arraysize(args), args) | 24449 fun->Call(env.local(), v8::Undefined(isolate), arraysize(args), args) |
24450 .ToLocalChecked(); | 24450 .ToLocalChecked(); |
24451 CHECK(!try_catch.HasCaught()); | 24451 CHECK(!try_catch.HasCaught()); |
24452 } | 24452 } |
24453 } | 24453 } |
24454 | 24454 |
24455 | 24455 |
24456 TEST(StrongObjectDelete) { | |
24457 i::FLAG_strong_mode = true; | |
24458 LocalContext env; | |
24459 v8::Isolate* isolate = env->GetIsolate(); | |
24460 v8::HandleScope scope(isolate); | |
24461 Local<Object> obj; | |
24462 { | |
24463 v8::TryCatch try_catch(isolate); | |
24464 obj = Local<Object>::Cast(CompileRun( | |
24465 "'use strong';" | |
24466 "({});")); | |
24467 CHECK(!try_catch.HasCaught()); | |
24468 } | |
24469 obj->DefineOwnProperty(env.local(), v8_str("foo"), v8_num(1), v8::None) | |
24470 .FromJust(); | |
24471 obj->DefineOwnProperty(env.local(), v8_str("2"), v8_num(1), v8::None) | |
24472 .FromJust(); | |
24473 CHECK(obj->HasOwnProperty(env.local(), v8_str("foo")).FromJust()); | |
24474 CHECK(obj->HasOwnProperty(env.local(), v8_str("2")).FromJust()); | |
24475 CHECK(!obj->Delete(env.local(), v8_str("foo")).FromJust()); | |
24476 CHECK(!obj->Delete(env.local(), 2).FromJust()); | |
24477 } | |
24478 | |
24479 | |
24480 static void ExtrasBindingTestRuntimeFunction( | 24456 static void ExtrasBindingTestRuntimeFunction( |
24481 const v8::FunctionCallbackInfo<v8::Value>& args) { | 24457 const v8::FunctionCallbackInfo<v8::Value>& args) { |
24482 CHECK_EQ( | 24458 CHECK_EQ( |
24483 3, | 24459 3, |
24484 args[0]->Int32Value(args.GetIsolate()->GetCurrentContext()).FromJust()); | 24460 args[0]->Int32Value(args.GetIsolate()->GetCurrentContext()).FromJust()); |
24485 args.GetReturnValue().Set(v8_num(7)); | 24461 args.GetReturnValue().Set(v8_num(7)); |
24486 } | 24462 } |
24487 | 24463 |
24488 TEST(ExtrasFunctionSource) { | 24464 TEST(ExtrasFunctionSource) { |
24489 v8::Isolate* isolate = CcTest::isolate(); | 24465 v8::Isolate* isolate = CcTest::isolate(); |
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
24995 CHECK(proxy->GetTarget()->SameValue(target)); | 24971 CHECK(proxy->GetTarget()->SameValue(target)); |
24996 CHECK(proxy->GetHandler()->SameValue(handler)); | 24972 CHECK(proxy->GetHandler()->SameValue(handler)); |
24997 | 24973 |
24998 proxy->Revoke(); | 24974 proxy->Revoke(); |
24999 CHECK(proxy->IsProxy()); | 24975 CHECK(proxy->IsProxy()); |
25000 CHECK(!target->IsProxy()); | 24976 CHECK(!target->IsProxy()); |
25001 CHECK(proxy->IsRevoked()); | 24977 CHECK(proxy->IsRevoked()); |
25002 CHECK(proxy->GetTarget()->SameValue(target)); | 24978 CHECK(proxy->GetTarget()->SameValue(target)); |
25003 CHECK(proxy->GetHandler()->IsNull()); | 24979 CHECK(proxy->GetHandler()->IsNull()); |
25004 } | 24980 } |
OLD | NEW |