Add passing test Object-isSealed-01.js. no_r=me.
authorJason Orendorff <jorendorff@mozilla.com>
Thu, 11 Aug 2011 01:33:19 -0500
changeset 75241 7cb52e5580ff1627e7ce118b220de3da4206ca2a
parent 75240 746e5c170b3620298b438d7934e3fa8e4bef0fc2
child 75242 d714c406a71c6fee3dbde3ca8dd151702582a7c0
push id2
push userbsmedberg@mozilla.com
push dateFri, 19 Aug 2011 14:38:13 +0000
milestone8.0a1
Add passing test Object-isSealed-01.js. no_r=me.
js/src/jit-test/tests/debug/Object-isSealed-01.js
new file mode 100644
--- /dev/null
+++ b/js/src/jit-test/tests/debug/Object-isSealed-01.js
@@ -0,0 +1,32 @@
+// Basic tests for Debugger.Object.prototype.{isSealed,isFrozen,isExtensible}.
+
+var g = newGlobal("new-compartment");
+var dbg = new Debugger;
+var gw = dbg.addDebuggee(g);
+
+function test(code) {
+    g.eval("x = (" + code + ");");
+    var xw = gw.getOwnPropertyDescriptor("x").value;
+
+    function check() {
+	assertEq(xw.isSealed(), g.Object.isSealed(g.x));
+	assertEq(xw.isFrozen(), g.Object.isFrozen(g.x));
+	assertEq(xw.isExtensible(), g.Object.isExtensible(g.x));
+    }
+
+    check();
+    g.Object.preventExtensions(g.x);
+    check();
+    g.Object.seal(g.x);
+    check();
+    g.Object.freeze(g.x);
+    check();
+}
+
+test("{}");
+test("{a: [1]}");
+test("Object.create(null, {x: {value: 3}, y: {get: Math.min}})");
+test("[]");
+test("[,,,,,]");
+test("[0, 1, 2]");
+test("this");  // This freezes g, so insert new tests before this line.