Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/llv8-constants.cc
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ void Types::Load() {
kFirstContextType = LoadConstant("FirstContextType");
kLastContextType = LoadConstant("LastContextType");

kJSErrorType = LoadConstant("type_JSError__JS_ERROR_TYPE");
kHeapNumberType = LoadConstant("type_HeapNumber__HEAP_NUMBER_TYPE");
kMapType = LoadConstant("type_Map__MAP_TYPE");
kGlobalObjectType =
Expand Down
1 change: 1 addition & 0 deletions src/llv8-constants.h
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,7 @@ class Types : public Module {
int64_t kFirstContextType;
int64_t kLastContextType;

int64_t kJSErrorType;
int64_t kHeapNumberType;
int64_t kMapType;
int64_t kGlobalObjectType;
Expand Down
1 change: 1 addition & 0 deletions src/llv8-inl.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,6 +211,7 @@ ACCESSOR(JSObject, Elements, js_object()->kElementsOffset, HeapObject)
inline bool JSObject::IsObjectType(LLV8* v8, int64_t type) {
return type == v8->types()->kJSObjectType ||
type == v8->types()->kJSAPIObjectType ||
type == v8->types()->kJSErrorType ||
type == v8->types()->kJSSpecialAPIObjectType;
}

Expand Down
4 changes: 4 additions & 0 deletions test/fixtures/inspect-scenario.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ function closure() {
);
c.hashmap['buffer'] = Buffer.from([0xff, 0xf0, 0x80, 0x0f, 0x01, 0x00]);

c.hashmap['error'] = new Error('test');
c.hashmap['error'].code = 'ERR_TEST';
c.hashmap['error'].errno = 1;

c.hashmap[0] = null;
c.hashmap[4] = undefined;
c.hashmap[23] = /regexp/;
Expand Down
22 changes: 22 additions & 0 deletions test/plugin/inspect-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,28 @@ const hashMapTests = {
re: /.sliced-externalized-string=(0x[0-9a-f]+):<String: "\(external\)">/,
desc: '.sliced-externalized-string Sliced ExternalString property'
},
// .error=0x0000392d5d661119:<Object: Error>

This comment was marked as off-topic.

This comment was marked as off-topic.

'error': {
re: /.error=(0x[0-9a-f]+):<Object: Error>/,
desc: '.error Error property',
validator(t, sess, addresses, name, cb) {
const address = addresses[name];
sess.send(`v8 inspect ${address}`);

sess.linesUntil(/}>/, (err, lines) => {
if (err) return cb(err);
lines = lines.join('\n');

let codeMatch = lines.match(/code=(0x[0-9a-f]+):<String: "ERR_TEST">/i);
t.ok(codeMatch, 'hashmap.error.code should be "ERR_TEST"');

let errnoMatch = lines.match(/errno=<Smi: 1>/i);
t.ok(errnoMatch, 'hashmap.error.errno should be 1');

cb(null);
});
}
},
// .array=0x000003df9cbe7919:<Array: length=6>,
'array': {
re: /.array=(0x[0-9a-f]+):<Array: length=6>/,
Expand Down