# HG changeset patch # User Atul Varma # Date 1245702585 25200 # Node ID d5087fb2367d2c3b3a4a7afd99afe68398881cc0 # Parent 82d800f2dcfced185f00d2c49b8f95ed81fdaa5a Added more to SafeWrapper. diff -r 82d800f2dcfc -r d5087fb2367d tcb.js --- a/tcb.js Mon Jun 22 13:17:34 2009 -0700 +++ b/tcb.js Mon Jun 22 13:29:45 2009 -0700 @@ -128,10 +128,15 @@ case "__parent__": return null; default: + // TODO: This will bypass any getters/setters. return this._maybeWrap(lookupProperty(wrappee, id)); } }, + addProperty: function() { + throw new Error("Can't add properties to this object."); + }, + setProperty: function() { throw new Error("Can't set properties on this object."); }, @@ -140,6 +145,32 @@ throw new Error("Can't delete properties on this object."); }, + equality: function(wrappee, wrapper, other) { + return wrappee == other; + }, + + enumerate: function() { + throw new Error("Enumeration is not implemented."); + }, + + iteratorObject: function(wrappee, wrapper, keysOnly) { + if (keysOnly) { + function keyIterator() { + // TODO: Is this secure? + for (name in wrappee) + yield name; + } + return keyIterator(); + } else { + function keyValueIterator() { + // TODO: Is this secure? + for (name in wrappee) + yield [name, wrappee[name]]; + } + return keyValueIterator(); + } + }, + _callOrConstruct: function(wrapee, wrapper, thisObj, args) { if (typeof(this._wrappee) == "function") { var wrappedArgs = [];