mirror of
https://github.com/nodejs/node.git
synced 2024-11-29 23:16:30 +01:00
708084aea1
PR-URL: https://github.com/nodejs/node/pull/15873 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
24 lines
442 B
JavaScript
24 lines
442 B
JavaScript
'use strict';
|
|
|
|
require('../common');
|
|
const assert = require('assert');
|
|
|
|
const vm = require('vm');
|
|
|
|
const symbol = Symbol();
|
|
|
|
function Document() {
|
|
this[symbol] = 'foo';
|
|
}
|
|
|
|
Document.prototype.getSymbolValue = function() {
|
|
return this[symbol];
|
|
};
|
|
|
|
const context = new Document();
|
|
vm.createContext(context);
|
|
|
|
assert.strictEqual(context.getSymbolValue(), 'foo');
|
|
|
|
assert.strictEqual(vm.runInContext('this.getSymbolValue()', context), 'foo');
|