Issue Links

Activity

It seems that the current version of v8 using doesn't support various ES5 features like Object.freeze() and Object.seal() when the object was instantiated from an ObjectTemplate with NamedPropertyHandlers.

However, these appear to work once the properties of an object have been accessed:

Ben Becker (Inactive)
added a comment - Feb 14 2013 11:31:08 PM +00:00 It seems that the current version of v8 using doesn't support various ES5 features like Object.freeze() and Object.seal() when the object was instantiated from an ObjectTemplate with NamedPropertyHandlers.
However, these appear to work once the properties of an object have been accessed:
for (var i in x) { }
// - or -
Object.keys\(x).forEach(function(p){x[p]});
A simple hack exemplifying this case:
diff --git a/src/third_party/v8/src/v8natives.js b/src/third_party/v8/src/v8natives.js
index e2e6429..b75c1cc 100644
--- a/src/third_party/v8/src/v8natives.js
+++ b/src/third_party/v8/src/v8natives.js
@@ -978,6 +978,7 @@ function ObjectGetOwnPropertyNames(obj) {
if (!IS_SPEC_OBJECT(obj)) {
throw MakeTypeError("called_on_non_object", ["Object.getOwnPropertyNames"]);
}
+ for (var i in obj) {}
// Special handling for proxies.
if (%IsJSProxy(obj)) {
var handler = %GetHandler(obj);