Commit 2c615439 authored by wingo@igalia.com's avatar wingo@igalia.com

Mirror object properties are always names

R=aandrey@chromium.org, rossberg@chromium.org, yangguo@chromium.org
BUG=

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

git-svn-id: https://v8.googlecode.com/svn/branches/bleeding_edge@22959 ce2b1a6d-e550-0410-aec6-3dcde31c8c00
parent 284d23db
...@@ -797,7 +797,7 @@ ObjectMirror.prototype.internalProperties = function() { ...@@ -797,7 +797,7 @@ ObjectMirror.prototype.internalProperties = function() {
ObjectMirror.prototype.property = function(name) { ObjectMirror.prototype.property = function(name) {
var details = %DebugGetPropertyDetails(this.value_, %ToString(name)); var details = %DebugGetPropertyDetails(this.value_, %ToName(name));
if (details) { if (details) {
return new PropertyMirror(this, name, details); return new PropertyMirror(this, name, details);
} }
......
...@@ -111,12 +111,14 @@ function testObjectMirror(obj, cls_name, ctor_name, hasSpecialProperties) { ...@@ -111,12 +111,14 @@ function testObjectMirror(obj, cls_name, ctor_name, hasSpecialProperties) {
// Check that the serialization contains all properties. // Check that the serialization contains all properties.
assertEquals(names.length, fromJSON.properties.length, 'Some properties missing in JSON'); assertEquals(names.length, fromJSON.properties.length, 'Some properties missing in JSON');
for (var i = 0; i < fromJSON.properties.length; i++) { for (var j = 0; j < names.length; j++) {
var name = fromJSON.properties[i].name; var name = names[j];
if (typeof name == 'undefined') name = fromJSON.properties[i].index; // Serialization of symbol-named properties to JSON doesn't really
// work currently, as they don't get a {name: ...} entry.
if (typeof name === 'symbol') continue;
var found = false; var found = false;
for (var j = 0; j < names.length; j++) { for (var i = 0; i < fromJSON.properties.length; i++) {
if (names[j] == name) { if (fromJSON.properties[i].name == name) {
// Check that serialized handle is correct. // Check that serialized handle is correct.
assertEquals(properties[i].value().handle(), fromJSON.properties[i].ref, 'Unexpected serialized handle'); assertEquals(properties[i].value().handle(), fromJSON.properties[i].ref, 'Unexpected serialized handle');
...@@ -170,6 +172,9 @@ function Point(x,y) { ...@@ -170,6 +172,9 @@ function Point(x,y) {
this.y_ = y; this.y_ = y;
} }
var object_with_symbol = {};
object_with_symbol[Symbol.iterator] = 42;
// Test a number of different objects. // Test a number of different objects.
testObjectMirror({}, 'Object', 'Object'); testObjectMirror({}, 'Object', 'Object');
testObjectMirror({'a':1,'b':2}, 'Object', 'Object'); testObjectMirror({'a':1,'b':2}, 'Object', 'Object');
...@@ -180,6 +185,7 @@ testObjectMirror(this.__proto__, 'Object', ''); ...@@ -180,6 +185,7 @@ testObjectMirror(this.__proto__, 'Object', '');
testObjectMirror([], 'Array', 'Array'); testObjectMirror([], 'Array', 'Array');
testObjectMirror([1,2], 'Array', 'Array'); testObjectMirror([1,2], 'Array', 'Array');
testObjectMirror(Object(17), 'Number', 'Number'); testObjectMirror(Object(17), 'Number', 'Number');
testObjectMirror(object_with_symbol, 'Object', 'Object');
// Test circular references. // Test circular references.
o = {}; o = {};
......
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