Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(641)

Unified Diff: test/cctest/test-api.cc

Issue 4236: This is a fix of issue http://b/issue?id=1381845.... (Closed) Base URL: http://v8.googlecode.com/svn/branches/bleeding_edge/
Patch Set: Created 12 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « src/handles.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: test/cctest/test-api.cc
===================================================================
--- test/cctest/test-api.cc (revision 366)
+++ test/cctest/test-api.cc (working copy)
@@ -3167,7 +3167,39 @@
}
+THREADED_TEST(CrossDomainForIn) {
+ v8::HandleScope handle_scope;
+ LocalContext env1;
+ v8::Persistent<Context> env2 = Context::New();
+ Local<Value> foo = v8_str("foo");
+ Local<Value> bar = v8_str("bar");
+
+ // Set to the same domain.
+ env1->SetSecurityToken(foo);
+ env2->SetSecurityToken(foo);
+
+ env1->Global()->Set(v8_str("prop"), v8_num(3));
+ env2->Global()->Set(v8_str("env1"), env1->Global());
+
+ // Change env2 to a different domain and set env1's global object
+ // as the __proto__ of an object in env2 and enumerate properties
+ // in for-in. It shouldn't enumerate properties on env1's global
+ // object.
+ env2->SetSecurityToken(bar);
+ {
+ Context::Scope scope_env2(env2);
+ Local<Value> result =
+ Script::Compile(v8_str("(function(){var obj = {'__proto__':env1};\
Mads Ager (chromium) 2008/09/24 06:09:21 I find it easier to read if you do not use \ and i
Feng Qian 2008/09/24 15:30:27 Done.
+ for (var p in obj) \
+ if (p == 'prop') return false; \
+ return true;})()"))->Run();
+ CHECK(result->IsTrue());
+ }
+ env2.Dispose();
+}
+
+
static bool NamedAccessBlocker(Local<v8::Object> global,
Local<Value> name,
v8::AccessType type,
« no previous file with comments | « src/handles.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698