OLD | NEW |
1 // Copyright 2007-2008 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2008 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 1275 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1286 v8::HandleScope scope; | 1286 v8::HandleScope scope; |
1287 LocalContext env; | 1287 LocalContext env; |
1288 | 1288 |
1289 v8::Local<v8::Object> obj = v8::Object::New(); | 1289 v8::Local<v8::Object> obj = v8::Object::New(); |
1290 v8::Local<v8::String> key = v8_str("api-test::hidden-key"); | 1290 v8::Local<v8::String> key = v8_str("api-test::hidden-key"); |
1291 v8::Local<v8::String> empty = v8_str(""); | 1291 v8::Local<v8::String> empty = v8_str(""); |
1292 v8::Local<v8::String> prop_name = v8_str("prop_name"); | 1292 v8::Local<v8::String> prop_name = v8_str("prop_name"); |
1293 | 1293 |
1294 i::Heap::CollectAllGarbage(); | 1294 i::Heap::CollectAllGarbage(); |
1295 | 1295 |
| 1296 // Make sure delete of a non-existent hidden value works |
| 1297 CHECK(obj->DeleteHiddenValue(key)); |
| 1298 |
1296 CHECK(obj->SetHiddenValue(key, v8::Integer::New(1503))); | 1299 CHECK(obj->SetHiddenValue(key, v8::Integer::New(1503))); |
1297 CHECK_EQ(1503, obj->GetHiddenValue(key)->Int32Value()); | 1300 CHECK_EQ(1503, obj->GetHiddenValue(key)->Int32Value()); |
1298 CHECK(obj->SetHiddenValue(key, v8::Integer::New(2002))); | 1301 CHECK(obj->SetHiddenValue(key, v8::Integer::New(2002))); |
1299 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); | 1302 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); |
1300 | 1303 |
1301 i::Heap::CollectAllGarbage(); | 1304 i::Heap::CollectAllGarbage(); |
1302 | 1305 |
1303 // Make sure we do not find the hidden property. | 1306 // Make sure we do not find the hidden property. |
1304 CHECK(!obj->Has(empty)); | 1307 CHECK(!obj->Has(empty)); |
1305 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); | 1308 CHECK_EQ(2002, obj->GetHiddenValue(key)->Int32Value()); |
(...skipping 4833 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6139 // Check without 'eval' or 'with'. | 6142 // Check without 'eval' or 'with'. |
6140 v8::Handle<v8::Value> res = | 6143 v8::Handle<v8::Value> res = |
6141 CompileRun("function f() { x = 42; return x; }; f()"); | 6144 CompileRun("function f() { x = 42; return x; }; f()"); |
6142 // Check with 'eval'. | 6145 // Check with 'eval'. |
6143 res = CompileRun("function f() { eval('1'); y = 42; return y; }; f()"); | 6146 res = CompileRun("function f() { eval('1'); y = 42; return y; }; f()"); |
6144 CHECK_EQ(v8::Integer::New(42), res); | 6147 CHECK_EQ(v8::Integer::New(42), res); |
6145 // Check with 'with'. | 6148 // Check with 'with'. |
6146 res = CompileRun("function f() { with (this) { y = 42 }; return y; }; f()"); | 6149 res = CompileRun("function f() { with (this) { y = 42 }; return y; }; f()"); |
6147 CHECK_EQ(v8::Integer::New(42), res); | 6150 CHECK_EQ(v8::Integer::New(42), res); |
6148 } | 6151 } |
OLD | NEW |