summaryrefslogtreecommitdiff
path: root/deps/v8/test/mjsunit/object-freeze.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/v8/test/mjsunit/object-freeze.js')
-rw-r--r--deps/v8/test/mjsunit/object-freeze.js26
1 files changed, 11 insertions, 15 deletions
diff --git a/deps/v8/test/mjsunit/object-freeze.js b/deps/v8/test/mjsunit/object-freeze.js
index 15e19abbd1..c3a9278bbd 100644
--- a/deps/v8/test/mjsunit/object-freeze.js
+++ b/deps/v8/test/mjsunit/object-freeze.js
@@ -32,21 +32,25 @@
// Test that we throw an error if an object is not passed as argument.
var non_objects = new Array(undefined, null, 1, -1, 0, 42.43);
for (var key in non_objects) {
+ var exception = false;
try {
Object.freeze(non_objects[key]);
- assertUnreachable();
} catch(e) {
+ exception = true;
assertTrue(/Object.freeze called on non-object/.test(e));
}
+ assertTrue(exception);
}
for (var key in non_objects) {
+ exception = false;
try {
Object.isFrozen(non_objects[key]);
- assertUnreachable();
} catch(e) {
+ exception = true;
assertTrue(/Object.isFrozen called on non-object/.test(e));
}
+ assertTrue(exception);
}
// Test normal data properties.
@@ -70,12 +74,8 @@ Object.freeze(obj);
assertFalse(Object.isExtensible(obj));
assertTrue(Object.isFrozen(obj));
-try {
- obj.foo = 42;
- assertUnreachable();
-} catch(e) {
- assertTrue(/object is not extensible/.test(e));
-}
+obj.foo = 42;
+assertEquals(obj.foo, undefined);
desc = Object.getOwnPropertyDescriptor(obj, 'x');
assertFalse(desc.writable);
@@ -88,7 +88,7 @@ assertFalse(desc.configurable);
assertEquals("foobar", desc.value);
// Make sure that even if we try overwrite a value that is not writable, it is
-// not changed.
+// not changed.
obj.x = "tete";
assertEquals(42, obj.x);
obj.x = { get: function() {return 43}, set: function() {} };
@@ -118,12 +118,8 @@ assertEquals(undefined, desc.value);
assertEquals(set, desc.set);
assertEquals(get, desc.get);
-try {
- obj2.foo = 42;
- assertUnreachable();
-} catch(e) {
- assertTrue(/object is not extensible/.test(e));
-}
+obj2.foo = 42;
+assertEquals(obj2.foo, undefined);
// Test freeze on arrays.