mirror of https://github.com/lukechilds/node.git
Browse Source
PR-URL: https://github.com/nodejs/node/pull/14343 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>v6.x
committed by
Myles Borins
3 changed files with 35 additions and 1 deletions
@ -0,0 +1,30 @@ |
|||
'use strict'; |
|||
|
|||
require('../common'); |
|||
const assert = require('assert'); |
|||
const vm = require('vm'); |
|||
|
|||
const { MakeMirror } = vm.runInDebugContext('Debug'); |
|||
const proxy = new Proxy({ x: 1, y: 2 }, { get: Reflect.get }); |
|||
const mirror = MakeMirror(proxy, /* transient */ true); |
|||
|
|||
assert.strictEqual(mirror.protoObject().value(), undefined); |
|||
assert.strictEqual(mirror.className(), 'Object'); |
|||
assert.strictEqual(mirror.constructorFunction().value(), undefined); |
|||
assert.strictEqual(mirror.prototypeObject().value(), undefined); |
|||
assert.strictEqual(mirror.hasNamedInterceptor(), false); |
|||
assert.strictEqual(mirror.hasIndexedInterceptor(), false); |
|||
assert.strictEqual(mirror.referencedBy(1).length, 0); |
|||
assert.strictEqual(mirror.toText(), '#<Object>'); |
|||
|
|||
const propertyNames = mirror.propertyNames(); |
|||
const DebugContextArray = propertyNames.constructor; |
|||
assert.deepStrictEqual(propertyNames, DebugContextArray.from(['x', 'y'])); |
|||
|
|||
const properties = mirror.properties(); |
|||
assert.strictEqual(properties.length, 2); |
|||
// UndefinedMirror because V8 cannot retrieve the values without invoking
|
|||
// the handler. Could be turned a PropertyMirror but mirror.value() would
|
|||
// still be an UndefinedMirror. This seems Good Enough for now.
|
|||
assert(properties[0].isUndefined()); |
|||
assert(properties[1].isUndefined()); |
Loading…
Reference in new issue