Throw an exception when an access check fails and no external callback is installed

R=yangguo@chromium.org

Review URL: https://codereview.chromium.org/428733007

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22698 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 29f2cf23
......@@ -638,7 +638,11 @@ static inline AccessCheckInfo* GetAccessCheckInfo(Isolate* isolate,
void Isolate::ReportFailedAccessCheck(Handle<JSObject> receiver,
v8::AccessType type) {
if (!thread_local_top()->failed_access_check_callback_) return;
if (!thread_local_top()->failed_access_check_callback_) {
Handle<String> message = factory()->InternalizeUtf8String("no access");
ScheduleThrow(*factory()->NewTypeError(message));
return;
}
ASSERT(receiver->IsAccessCheckNeeded());
ASSERT(context());
......
......@@ -171,7 +171,7 @@ PropertyKind.Named = 1;
PropertyKind.Indexed = 2;
// A copy of the PropertyType enum from global.h
// A copy of the PropertyType enum from property-details.h
var PropertyType = {};
PropertyType.Normal = 0;
PropertyType.Field = 1;
......@@ -179,8 +179,7 @@ PropertyType.Constant = 2;
PropertyType.Callbacks = 3;
PropertyType.Handler = 4;
PropertyType.Interceptor = 5;
PropertyType.Transition = 6;
PropertyType.Nonexistent = 7;
PropertyType.Nonexistent = 6;
// Different attributes for a property.
......@@ -684,6 +683,19 @@ ObjectMirror.prototype.hasIndexedInterceptor = function() {
};
// Get all own property names except for private symbols.
function TryGetPropertyNames(object) {
try {
// TODO(yangguo): Should there be a special debugger implementation of
// %GetOwnPropertyNames that doesn't perform access checks?
return %GetOwnPropertyNames(object, PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL);
} catch (e) {
// Might have hit a failed access check.
return [];
}
}
/**
* Return the property names for this object.
* @param {number} kind Indicate whether named, indexed or both kinds of
......@@ -702,9 +714,7 @@ ObjectMirror.prototype.propertyNames = function(kind, limit) {
// Find all the named properties.
if (kind & PropertyKind.Named) {
// Get all own property names except for private symbols.
propertyNames =
%GetOwnPropertyNames(this.value_, PROPERTY_ATTRIBUTES_PRIVATE_SYMBOL);
propertyNames = TryGetPropertyNames(this.value_);
total += propertyNames.length;
// Get names for named interceptor properties if any.
......
This diff is collapsed.
......@@ -51,7 +51,7 @@ EXPECTED_FUNCTION_COUNT = 422
EXPECTED_FUZZABLE_COUNT = 336
EXPECTED_CCTEST_COUNT = 8
EXPECTED_UNKNOWN_COUNT = 4
EXPECTED_BUILTINS_COUNT = 815
EXPECTED_BUILTINS_COUNT = 816
# Don't call these at all.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment