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

Unified Diff: src/mirror-debugger.js

Issue 428733007: Throw an exception when an access check fails and no external callback is installed (Closed) Base URL: https://v8.googlecode.com/svn/branches/bleeding_edge
Patch Set: s/ReferenceError/TypeError/ per Toon's wish Created 6 years, 5 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/isolate.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: src/mirror-debugger.js
diff --git a/src/mirror-debugger.js b/src/mirror-debugger.js
index 35f34a91d48edcd1c26e3aa1a54fbbec06731e41..932294157b0258f297614ddd9abd50a23fbec98a 100644
--- a/src/mirror-debugger.js
+++ b/src/mirror-debugger.js
@@ -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.
« no previous file with comments | « src/isolate.cc ('k') | test/cctest/test-api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698