var cache = {};
var _gen = function(name)
{
if(cache.hasOwnProperty(name))
return cache[name];
// ...
return cache[name] = result;
};
_gen('__proto__') // oops!
_gen('__count__') // removed in gecko2. good
_gen('__parent__') // removed in gecko2. good
Also 1,{proto: 1}.proto === 1 // false 1,{proto: ''}.proto === '' // false 1,{proto: true}.proto === true // false
Remove all own __xxx__
properties from object and create some vendor specific API as __defineGetter__
ie for __proto__
-> Object#v8SetPrototype
or Object#__setPrototype__
Good behavior in SM. var a = {proto: null}; 1,{}.hasOwnProperty.call(a, 'proto') // false; 1,{}.hasOwnProperty.call(a, 'count') // false; 1,{}.hasOwnProperty.call(a, 'parent') // false; a.proto // undefined a.parent // undefined a.count // undefined But in V8 var a = {proto: null}; 1,{}.hasOwnProperty.call(a, 'proto') // true; a.proto // null