joyent/node — Issue #1919: createContext : cloneNodeMethod does not take into account that getOwnPropertyDescriptor can return undefined
Author: Nais
Created: 2011-10-21 12:32:14+00:00
State: open

Everything is said in the title, it is not rare that getOwnpropertyDescriptor returns undefined (see below, happens with _ _ proto _ _ too for example)

@indutny : node_script.cc issue "vm context with accessors" changes

````
var vm = require('vm');

var WINDOW = function() {
this.name = "window";
this.fn = function() {
console.log(this.name);
};
}

WINDOW.prototype.Image = function() {
console.log(this.name);
}

window = new WINDOW();

window.Image(); //window //OK

console.log(Object.getOwnPropertyDescriptor(window,'Image'));//undefined

ctx=vm.createContext(window);

console.log(ctx.Image); //undefined
//cloneObjectMethod does not take into account the fact that getOwnPropertyDescriptor can be undefined
````