Skip to content
Closed
Changes from 1 commit
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
6 changes: 6 additions & 0 deletions test/parallel/test-vm-context-property-forwarding.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,9 @@ assert.strictEqual(vm.runInContext('x;', ctx), 3);
vm.runInContext('y = 4;', ctx);
assert.strictEqual(sandbox.y, 4);
assert.strictEqual(ctx.y, 4);

const x = vm.createContext({ get a() { return 5; } });

assert.strictEqual(x.a, 5);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does IndexedPropertyGetterCallback apply for properties returning index values or indexed properties?

Reflect.defineProperty(x, '1', { get() { return 2 } })

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just tested that scenario and in fact, x[1] === 2. If that's the question. I'm not sure I quite understand it.

delete x.a;
assert.strictEqual(x.a, undefined);