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 21169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21180 | 21180 |
21181 { | 21181 { |
21182 v8::TryCatch try_catch; | 21182 v8::TryCatch try_catch; |
21183 v8::Handle<Value> args[] = {v8_num(42), v8_num(555)}; | 21183 v8::Handle<Value> args[] = {v8_num(42), v8_num(555)}; |
21184 fun->Call(v8::Undefined(isolate), arraysize(args), args); | 21184 fun->Call(v8::Undefined(isolate), arraysize(args), args); |
21185 CHECK(!try_catch.HasCaught()); | 21185 CHECK(!try_catch.HasCaught()); |
21186 } | 21186 } |
21187 } | 21187 } |
21188 | 21188 |
21189 | 21189 |
| 21190 TEST(StrongObjectDelete) { |
| 21191 i::FLAG_strong_mode = true; |
| 21192 LocalContext env; |
| 21193 v8::Isolate* isolate = env->GetIsolate(); |
| 21194 v8::HandleScope scope(isolate); |
| 21195 Local<Object> obj; |
| 21196 { |
| 21197 v8::TryCatch try_catch; |
| 21198 obj = Local<Object>::Cast(CompileRun( |
| 21199 "'use strong';" |
| 21200 "({});")); |
| 21201 CHECK(!try_catch.HasCaught()); |
| 21202 } |
| 21203 obj->ForceSet(v8_str("foo"), v8_num(1), v8::None); |
| 21204 obj->ForceSet(v8_str("2"), v8_num(1), v8::None); |
| 21205 CHECK(obj->HasOwnProperty(v8_str("foo"))); |
| 21206 CHECK(obj->HasOwnProperty(v8_str("2"))); |
| 21207 CHECK(!obj->Delete(v8_str("foo"))); |
| 21208 CHECK(!obj->Delete(2)); |
| 21209 } |
| 21210 |
| 21211 |
21190 TEST(ExtrasExportsObject) { | 21212 TEST(ExtrasExportsObject) { |
21191 v8::Isolate* isolate = CcTest::isolate(); | 21213 v8::Isolate* isolate = CcTest::isolate(); |
21192 v8::HandleScope handle_scope(isolate); | 21214 v8::HandleScope handle_scope(isolate); |
21193 LocalContext env; | 21215 LocalContext env; |
21194 | 21216 |
21195 // standalone.gypi ensures we include the test-extra.js file, which should | 21217 // standalone.gypi ensures we include the test-extra.js file, which should |
21196 // add the testExtraShouldReturnFive export | 21218 // add the testExtraShouldReturnFive export |
21197 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); | 21219 v8::Local<v8::Object> exports = env->GetExtrasExportsObject(); |
21198 | 21220 |
21199 auto func = | 21221 auto func = |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
21252 CHECK_EQ(2, set->Size()); | 21274 CHECK_EQ(2, set->Size()); |
21253 | 21275 |
21254 v8::Local<v8::Array> keys = set->AsArray(); | 21276 v8::Local<v8::Array> keys = set->AsArray(); |
21255 CHECK_EQ(2, keys->Length()); | 21277 CHECK_EQ(2, keys->Length()); |
21256 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); | 21278 CHECK_EQ(1, keys->Get(0).As<v8::Int32>()->Value()); |
21257 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); | 21279 CHECK_EQ(2, keys->Get(1).As<v8::Int32>()->Value()); |
21258 | 21280 |
21259 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); | 21281 set = v8::Set::FromArray(env.local(), keys).ToLocalChecked(); |
21260 CHECK_EQ(2, set->Size()); | 21282 CHECK_EQ(2, set->Size()); |
21261 } | 21283 } |
OLD | NEW |