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 4060 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4071 CHECK(result->IsBoolean()); | 4071 CHECK(result->IsBoolean()); |
4072 CHECK(result->BooleanValue()); | 4072 CHECK(result->BooleanValue()); |
4073 | 4073 |
4074 // Check that doing a cross eval works from within a global | 4074 // Check that doing a cross eval works from within a global |
4075 // with-statement. | 4075 // with-statement. |
4076 script = | 4076 script = |
4077 Script::Compile(v8_str("other.y = 1;" | 4077 Script::Compile(v8_str("other.y = 1;" |
4078 "with({x:2}){other.eval('x+y')}")); | 4078 "with({x:2}){other.eval('x+y')}")); |
4079 result = script->Run(); | 4079 result = script->Run(); |
4080 CHECK_EQ(3, result->Int32Value()); | 4080 CHECK_EQ(3, result->Int32Value()); |
| 4081 |
| 4082 // Check that you cannot use 'eval.call' with another object than the |
| 4083 // current global object. |
| 4084 v8::TryCatch try_catch; |
| 4085 script = |
| 4086 Script::Compile(v8_str("other.y = 1; eval.call(other, 'y')")); |
| 4087 result = script->Run(); |
| 4088 CHECK(try_catch.HasCaught()); |
4081 } | 4089 } |
4082 | 4090 |
4083 | 4091 |
4084 THREADED_TEST(CrossLazyLoad) { | 4092 THREADED_TEST(CrossLazyLoad) { |
4085 v8::HandleScope scope; | 4093 v8::HandleScope scope; |
4086 LocalContext other; | 4094 LocalContext other; |
4087 LocalContext current; | 4095 LocalContext current; |
4088 | 4096 |
4089 Local<String> token = v8_str("<security token>"); | 4097 Local<String> token = v8_str("<security token>"); |
4090 other->SetSecurityToken(token); | 4098 other->SetSecurityToken(token); |
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5207 LocalContext context; | 5215 LocalContext context; |
5208 Local<ObjectTemplate> templ = ObjectTemplate::New(); | 5216 Local<ObjectTemplate> templ = ObjectTemplate::New(); |
5209 templ->SetAccessCheckCallbacks(NamedSetAccessBlocker, | 5217 templ->SetAccessCheckCallbacks(NamedSetAccessBlocker, |
5210 IndexedSetAccessBlocker); | 5218 IndexedSetAccessBlocker); |
5211 templ->Set(v8_str("x"), v8::True()); | 5219 templ->Set(v8_str("x"), v8::True()); |
5212 Local<v8::Object> instance = templ->NewInstance(); | 5220 Local<v8::Object> instance = templ->NewInstance(); |
5213 context->Global()->Set(v8_str("obj"), instance); | 5221 context->Global()->Set(v8_str("obj"), instance); |
5214 Local<Value> value = CompileRun("obj.x"); | 5222 Local<Value> value = CompileRun("obj.x"); |
5215 CHECK(value->BooleanValue()); | 5223 CHECK(value->BooleanValue()); |
5216 } | 5224 } |
OLD | NEW |