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 5291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5302 // the global object for env2 which has the same security token as env1. | 5302 // the global object for env2 which has the same security token as env1. |
5303 result = CompileRun("other.p"); | 5303 result = CompileRun("other.p"); |
5304 CHECK(result->IsInt32()); | 5304 CHECK(result->IsInt32()); |
5305 CHECK_EQ(42, result->Int32Value()); | 5305 CHECK_EQ(42, result->Int32Value()); |
5306 | 5306 |
5307 env2.Dispose(); | 5307 env2.Dispose(); |
5308 env3.Dispose(); | 5308 env3.Dispose(); |
5309 } | 5309 } |
5310 | 5310 |
5311 | 5311 |
5312 static bool allowed_access_type[v8::ACCESS_KEYS] = { false }; | 5312 static bool allowed_access_type[v8::ACCESS_KEYS + 1] = { false }; |
5313 static bool NamedAccessBlocker(Local<v8::Object> global, | 5313 static bool NamedAccessBlocker(Local<v8::Object> global, |
5314 Local<Value> name, | 5314 Local<Value> name, |
5315 v8::AccessType type, | 5315 v8::AccessType type, |
5316 Local<Value> data) { | 5316 Local<Value> data) { |
5317 return Context::GetCurrent()->Global()->Equals(global) || | 5317 return Context::GetCurrent()->Global()->Equals(global) || |
5318 allowed_access_type[type]; | 5318 allowed_access_type[type]; |
5319 } | 5319 } |
5320 | 5320 |
5321 | 5321 |
5322 static bool IndexedAccessBlocker(Local<v8::Object> global, | 5322 static bool IndexedAccessBlocker(Local<v8::Object> global, |
(...skipping 6995 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
12318 v8::Context::Scope context_scope(context.local()); | 12318 v8::Context::Scope context_scope(context.local()); |
12319 | 12319 |
12320 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); | 12320 v8::Handle<v8::ObjectTemplate> tmpl = v8::ObjectTemplate::New(); |
12321 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); | 12321 tmpl->SetNamedPropertyHandler(Getter, NULL, NULL, NULL, Enumerator); |
12322 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); | 12322 context->Global()->Set(v8_str("o"), tmpl->NewInstance()); |
12323 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( | 12323 v8::Handle<v8::Array> result = v8::Handle<v8::Array>::Cast(CompileRun( |
12324 "var result = []; for (var k in o) result.push(k); result")); | 12324 "var result = []; for (var k in o) result.push(k); result")); |
12325 CHECK_EQ(1, result->Length()); | 12325 CHECK_EQ(1, result->Length()); |
12326 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); | 12326 CHECK_EQ(v8_str("universalAnswer"), result->Get(0)); |
12327 } | 12327 } |
OLD | NEW |