triAGENS/ArangoDB — pull request #959 by pluma (2014-07-23 14:37:04+00:00)
Title: Allow printing any object recursively that doesn't override toString.

The recursive console printing is currently useless for any object that doesn't specify its own `toString` method and doesn't have `Object.prototype` as its `[[Prototype]]`.

For example, the following will all print as `[object Object]`:

```js
console.log(Object.create({some: 'other object'}));
console.log(new (function MyCtor() {}));
```

The following will even throw an exception:

```js
console.log(Object.create(null)); // throws
// as will this:
var obj = Object.create(null);
obj.x = 'y';
console.log(obj); // throws
```

This PR changes the logic that decides whether to recursively print an object by looking at the object's `toString` method rather than its `__proto__` property (i.e. its `[[Prototype]]`). This means the print will still work as expected for built-in object types (`Date`, `RegExp`, etc) and any object that overrides its inherited `toString`. It also treats empty objects (i.e. objects that inherit from `null` rather than `Object.prototype`) as expected (i.e. the same way it treats regular objects).