OLD | NEW |
1 // Copyright 2007-2009 the V8 project authors. All rights reserved. | 1 // Copyright 2007-2009 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 3317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3328 | 3328 |
3329 | 3329 |
3330 ExpectBoolean("undetectable===null", false); | 3330 ExpectBoolean("undetectable===null", false); |
3331 ExpectBoolean("null===undetectable", false); | 3331 ExpectBoolean("null===undetectable", false); |
3332 ExpectBoolean("undetectable===undefined", false); | 3332 ExpectBoolean("undetectable===undefined", false); |
3333 ExpectBoolean("undefined===undetectable", false); | 3333 ExpectBoolean("undefined===undetectable", false); |
3334 ExpectBoolean("undetectable===undetectable", true); | 3334 ExpectBoolean("undetectable===undetectable", true); |
3335 } | 3335 } |
3336 | 3336 |
3337 | 3337 |
| 3338 |
| 3339 THREADED_TEST(ExtensibleOnUndetectable) { |
| 3340 v8::HandleScope scope; |
| 3341 LocalContext env; |
| 3342 |
| 3343 Local<v8::FunctionTemplate> desc = |
| 3344 v8::FunctionTemplate::New(0, v8::Handle<Value>()); |
| 3345 desc->InstanceTemplate()->MarkAsUndetectable(); // undetectable |
| 3346 |
| 3347 Local<v8::Object> obj = desc->GetFunction()->NewInstance(); |
| 3348 env->Global()->Set(v8_str("undetectable"), obj); |
| 3349 |
| 3350 Local<String> source = v8_str("undetectable.x = 42;" |
| 3351 "undetectable.x"); |
| 3352 |
| 3353 Local<Script> script = Script::Compile(source); |
| 3354 |
| 3355 CHECK_EQ(v8::Integer::New(42), script->Run()); |
| 3356 |
| 3357 ExpectBoolean("Object.isExtensible(undetectable)", true); |
| 3358 |
| 3359 source = v8_str("Object.preventExtensions(undetectable);"); |
| 3360 script = Script::Compile(source); |
| 3361 script->Run(); |
| 3362 ExpectBoolean("Object.isExtensible(undetectable)", false); |
| 3363 |
| 3364 source = v8_str("undetectable.y = 2000;"); |
| 3365 script = Script::Compile(source); |
| 3366 v8::TryCatch try_catch; |
| 3367 Local<Value> result = script->Run(); |
| 3368 CHECK(result.IsEmpty()); |
| 3369 CHECK(try_catch.HasCaught()); |
| 3370 } |
| 3371 |
| 3372 |
| 3373 |
3338 THREADED_TEST(UndetectableString) { | 3374 THREADED_TEST(UndetectableString) { |
3339 v8::HandleScope scope; | 3375 v8::HandleScope scope; |
3340 LocalContext env; | 3376 LocalContext env; |
3341 | 3377 |
3342 Local<String> obj = String::NewUndetectable("foo"); | 3378 Local<String> obj = String::NewUndetectable("foo"); |
3343 env->Global()->Set(v8_str("undetectable"), obj); | 3379 env->Global()->Set(v8_str("undetectable"), obj); |
3344 | 3380 |
3345 ExpectString("undetectable", "foo"); | 3381 ExpectString("undetectable", "foo"); |
3346 ExpectString("typeof undetectable", "undefined"); | 3382 ExpectString("typeof undetectable", "undefined"); |
3347 ExpectString("typeof(undetectable)", "undefined"); | 3383 ExpectString("typeof(undetectable)", "undefined"); |
(...skipping 7680 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
11028 | 11064 |
11029 ExpectString("str2.substring(2, 10);", "elspenda"); | 11065 ExpectString("str2.substring(2, 10);", "elspenda"); |
11030 | 11066 |
11031 ExpectString("str2.substring(2, 20);", "elspendabelabelspe"); | 11067 ExpectString("str2.substring(2, 20);", "elspendabelabelspe"); |
11032 | 11068 |
11033 ExpectString("str2.charAt(2);", "e"); | 11069 ExpectString("str2.charAt(2);", "e"); |
11034 | 11070 |
11035 reresult = CompileRun("str2.charCodeAt(2);"); | 11071 reresult = CompileRun("str2.charCodeAt(2);"); |
11036 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value()); | 11072 CHECK_EQ(static_cast<int32_t>('e'), reresult->Int32Value()); |
11037 } | 11073 } |
OLD | NEW |