Revision: 6790
Author: [email protected]
Date: Tue Feb 15 05:36:41 2011
Log: Merge bleeding_edge revision 6786 to trunk.
Review URL: http://codereview.chromium.org/6523022
http://code.google.com/p/v8/source/detail?r=6790
Modified:
/trunk/src/runtime.cc
/trunk/src/version.cc
/trunk/test/cctest/test-api.cc
=======================================
--- /trunk/src/runtime.cc Mon Feb 14 04:05:43 2011
+++ /trunk/src/runtime.cc Tue Feb 15 05:36:41 2011
@@ -4214,6 +4214,14 @@
Handle<JSObject> object(raw_object);
if (object->IsJSGlobalProxy()) {
+ // Do access checks before going to the global object.
+ if (object->IsAccessCheckNeeded() &&
+ !Top::MayNamedAccess(*object, Heap::undefined_value(),
+ v8::ACCESS_KEYS)) {
+ Top::ReportFailedAccessCheck(*object, v8::ACCESS_KEYS);
+ return *Factory::NewJSArray(0);
+ }
+
Handle<Object> proto(object->GetPrototype());
// If proxy is detached we simply return an empty array.
if (proto->IsNull()) return *Factory::NewJSArray(0);
=======================================
--- /trunk/src/version.cc Mon Feb 14 04:05:43 2011
+++ /trunk/src/version.cc Tue Feb 15 05:36:41 2011
@@ -35,7 +35,7 @@
#define MAJOR_VERSION 3
#define MINOR_VERSION 1
#define BUILD_NUMBER 4
-#define PATCH_LEVEL 0
+#define PATCH_LEVEL 1
#define CANDIDATE_VERSION false
// Define SONAME to have the SCons build the put a specific SONAME into the
=======================================
--- /trunk/test/cctest/test-api.cc Mon Feb 14 04:05:43 2011
+++ /trunk/test/cctest/test-api.cc Tue Feb 15 05:36:41 2011
@@ -5615,6 +5615,35 @@
context1.Dispose();
context0.Dispose();
}
+
+
+// This is a regression test for issue 1154.
+TEST(AccessControlObjectKeys) {
+ v8::HandleScope handle_scope;
+ v8::Handle<v8::ObjectTemplate> global_template =
v8::ObjectTemplate::New();
+
+ global_template->SetAccessCheckCallbacks(NamedAccessBlocker,
+ IndexedAccessBlocker);
+
+ // Add an accessor that is not accessible by cross-domain JS code.
+ global_template->SetAccessor(v8_str("blocked_prop"),
+ UnreachableGetter, UnreachableSetter,
+ v8::Handle<Value>(),
+ v8::DEFAULT);
+
+ // Create an environment
+ v8::Persistent<Context> context0 = Context::New(NULL, global_template);
+ context0->Enter();
+
+ v8::Handle<v8::Object> global0 = context0->Global();
+
+ v8::Persistent<Context> context1 = Context::New();
+ context1->Enter();
+ v8::Handle<v8::Object> global1 = context1->Global();
+ global1->Set(v8_str("other"), global0);
+
+ ExpectTrue("Object.keys(other).indexOf('blocked_prop') == -1");
+}
static bool GetOwnPropertyNamesNamedBlocker(Local<v8::Object> global,
--
v8-dev mailing list
[email protected]
http://groups.google.com/group/v8-dev