Object.seal(obj) and Object.freeze(obj) should return the input obj.
authorsgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 5 Aug 2010 10:56:15 +0000 (10:56 +0000)
committersgjesse@chromium.org <sgjesse@chromium.org@ce2b1a6d-e550-0410-aec6-3dcde31c8c00>
Thu, 5 Aug 2010 10:56:15 +0000 (10:56 +0000)
BUG=http://code.google.com/p/v8/issues/detail?id=809
TEST=Seal/freeze an object and check if Object.seal and Object.freeze returns the given object.

Burcu Dogan <burcujdogan@gmail.com>

Review URL: http://codereview.chromium.org/3056049

git-svn-id: http://v8.googlecode.com/svn/branches/bleeding_edge@5176 ce2b1a6d-e550-0410-aec6-3dcde31c8c00

AUTHORS
src/v8natives.js
test/mjsunit/object-freeze.js
test/mjsunit/object-seal.js

diff --git a/AUTHORS b/AUTHORS
index 7e8f1f8d5245fe8bebcc298c80901768d9eff511..4d87db3be0b3998268d86b5f18c83dde78e006bc 100644 (file)
--- a/AUTHORS
+++ b/AUTHORS
@@ -28,4 +28,5 @@ Rene Rebe <rene@exactcode.de>
 Rodolph Perfetta <rodolph.perfetta@arm.com>
 Ryan Dahl <coldredlemur@gmail.com>
 Subrato K De <subratokde@codeaurora.org>
+Burcu Dogan <burcujdogan@gmail.com>
 
index 6eb13719638a9359fb30e3361e660b990e2fc8cb..85540e85df94ebe6b48f8dff1e8ff4804421747f 100644 (file)
@@ -749,7 +749,7 @@ function ObjectSeal(obj) {
     if (desc.isConfigurable()) desc.setConfigurable(false);
     DefineOwnProperty(obj, name, desc, true);
   }  
-  ObjectPreventExtension(obj);
+  return ObjectPreventExtension(obj);
 }
 
 
@@ -766,7 +766,7 @@ function ObjectFreeze(obj) {
     if (desc.isConfigurable()) desc.setConfigurable(false);
     DefineOwnProperty(obj, name, desc, true);
   }  
-  ObjectPreventExtension(obj);
+  return ObjectPreventExtension(obj);
 }
 
 
index 5ab45e1f27fe54950987019f7de35c13f35f6639..15e19abbd18f61f6b01730745150256816f013aa 100644 (file)
@@ -191,3 +191,7 @@ Object.defineProperty(obj5, 'y', {configurable: false, writable: false});
 Object.preventExtensions(obj5);
 
 assertFalse(Object.isFrozen(obj5));
+
+// Make sure that Object.freeze returns the frozen object.
+var obj6 = {}
+assertTrue(obj6 === Object.freeze(obj6))
index 896411ca3f7d75663cf37f17bad560ff66fc19e2..9e7f44b9c6857757d4d660896913097e3b547278 100644 (file)
@@ -193,3 +193,7 @@ Object.defineProperty(obj4, 'y', {configurable: false, writable: false});
 Object.preventExtensions(obj4);
 
 assertFalse(Object.isSealed(obj4));
+
+// Make sure that Object.seal returns the sealed object.
+var obj4 = {}
+assertTrue(obj4 === Object.seal(obj4))