OLD | NEW |
1 // Copyright 2011 the V8 project authors. All rights reserved. | 1 // Copyright 2011 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 14462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
14473 | 14473 |
14474 THREADED_TEST(CallAPIFunctionOnNonObject) { | 14474 THREADED_TEST(CallAPIFunctionOnNonObject) { |
14475 v8::HandleScope scope; | 14475 v8::HandleScope scope; |
14476 LocalContext context; | 14476 LocalContext context; |
14477 Handle<FunctionTemplate> templ = v8::FunctionTemplate::New(NonObjectThis); | 14477 Handle<FunctionTemplate> templ = v8::FunctionTemplate::New(NonObjectThis); |
14478 Handle<Function> function = templ->GetFunction(); | 14478 Handle<Function> function = templ->GetFunction(); |
14479 context->Global()->Set(v8_str("f"), function); | 14479 context->Global()->Set(v8_str("f"), function); |
14480 TryCatch try_catch; | 14480 TryCatch try_catch; |
14481 CompileRun("f.call(2)"); | 14481 CompileRun("f.call(2)"); |
14482 } | 14482 } |
| 14483 |
| 14484 |
| 14485 // Regression test for issue 1470. |
| 14486 THREADED_TEST(ReadOnlyIndexedProperties) { |
| 14487 v8::HandleScope scope; |
| 14488 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
| 14489 |
| 14490 LocalContext context; |
| 14491 Local<v8::Object> obj = templ->NewInstance(); |
| 14492 context->Global()->Set(v8_str("obj"), obj); |
| 14493 obj->Set(v8_str("1"), v8_str("DONT_CHANGE"), v8::ReadOnly); |
| 14494 obj->Set(v8_str("1"), v8_str("foobar")); |
| 14495 CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("1"))); |
| 14496 obj->Set(v8_num(2), v8_str("DONT_CHANGE"), v8::ReadOnly); |
| 14497 obj->Set(v8_num(2), v8_str("foobar")); |
| 14498 CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_num(2))); |
| 14499 |
| 14500 // Test non-smi case. |
| 14501 obj->Set(v8_str("2000000000"), v8_str("DONT_CHANGE"), v8::ReadOnly); |
| 14502 obj->Set(v8_str("2000000000"), v8_str("foobar")); |
| 14503 CHECK_EQ(v8_str("DONT_CHANGE"), obj->Get(v8_str("2000000000"))); |
| 14504 } |
OLD | NEW |