Merge pull request #261 from smikes/object-strict

strict mode: use new property helpers
This commit is contained in:
Brian Terlson 2015-05-07 13:15:07 -07:00
commit 5188ab028a
55 changed files with 554 additions and 673 deletions

View File

@ -7,10 +7,9 @@
/*--- /*---
es5id: 15.2.3.9-2-4 es5id: 15.2.3.9-2-4
description: Object.freeze - Non-enumerable own properties of 'O' are frozen description: Object.freeze - Non-enumerable own properties of 'O' are frozen
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
Object.defineProperty(obj, "foo", { Object.defineProperty(obj, "foo", {
@ -21,12 +20,6 @@ function testcase() {
Object.freeze(obj); Object.freeze(obj);
var desc = Object.getOwnPropertyDescriptor(obj, "foo"); assert(obj.hasOwnProperty("foo"));
verifyNotWritable(obj, "foo");
var beforeDeleted = obj.hasOwnProperty("foo"); verifyNotConfigurable(obj, "foo");
delete obj.foo;
var afterDeleted = obj.hasOwnProperty("foo");
return beforeDeleted && afterDeleted && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -7,19 +7,16 @@
/*--- /*---
es5id: 15.2.3.9-2-a-1 es5id: 15.2.3.9-2-a-1
description: Object.freeze - 'P' is own data property description: Object.freeze - 'P' is own data property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
obj.foo = 10; // default [[Configurable]] attribute value of foo: true obj.foo = 10; // default [[Configurable]] attribute value of foo: true
Object.freeze(obj); Object.freeze(obj);
var desc = Object.getOwnPropertyDescriptor(obj, "foo"); verifyNotWritable(obj, "foo");
verifyNotConfigurable(obj, "foo");
delete obj.foo; assert.sameValue(obj.foo, 10);
return obj.foo === 10 && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -9,19 +9,16 @@ es5id: 15.2.3.9-2-a-10
description: > description: >
Object.freeze - 'P' is own named property of an Array object that Object.freeze - 'P' is own named property of an Array object that
uses Object's [[GetOwnProperty]] uses Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var arrObj = []; var arrObj = [];
arrObj.foo = 10; // default [[Configurable]] attribute value of foo: true arrObj.foo = 10; // default [[Configurable]] attribute value of foo: true
Object.freeze(arrObj); Object.freeze(arrObj);
var desc = Object.getOwnPropertyDescriptor(arrObj, "foo"); verifyNotWritable(arrObj, "foo");
verifyNotConfigurable(arrObj, "foo");
delete arrObj.foo; assert.sameValue(arrObj.foo, 10);
return arrObj.foo === 10 && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -9,10 +9,9 @@ es5id: 15.2.3.9-2-a-11
description: > description: >
Object.freeze - 'P' is own index property of the Arguments object Object.freeze - 'P' is own index property of the Arguments object
that implements its own [[GetOwnProperty]] that implements its own [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
// default [[Configurable]] attribute value of "0": true // default [[Configurable]] attribute value of "0": true
var argObj = (function () { return arguments; }(1, 2, 3)); var argObj = (function () { return arguments; }(1, 2, 3));
@ -21,7 +20,7 @@ function testcase() {
var desc = Object.getOwnPropertyDescriptor(argObj, "0"); var desc = Object.getOwnPropertyDescriptor(argObj, "0");
delete argObj[0]; verifyNotWritable(argObj, "0");
return argObj[0] === 1 && desc.configurable === false && desc.writable === false; verifyNotConfigurable(argObj, "0");
} assert.sameValue(argObj[0], 1);
runTestCase(testcase);

View File

@ -9,19 +9,16 @@ es5id: 15.2.3.9-2-a-12
description: > description: >
Object.freeze - 'P' is own index property of a String object that Object.freeze - 'P' is own index property of a String object that
implements its own [[GetOwnProperty]] implements its own [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
// default [[Configurable]] attribute value of "0": true // default [[Configurable]] attribute value of "0": true
var strObj = new String("abc"); var strObj = new String("abc");
Object.freeze(strObj); Object.freeze(strObj);
var desc = Object.getOwnPropertyDescriptor(strObj, "0"); verifyNotWritable(strObj, "0");
verifyNotConfigurable(strObj, "0");
delete strObj[0]; assert.sameValue(strObj[0], "a");
return strObj[0] === "a" && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -7,19 +7,16 @@
/*--- /*---
es5id: 15.2.3.9-2-a-13 es5id: 15.2.3.9-2-a-13
description: Object.freeze - 'P' is own index property of the Object description: Object.freeze - 'P' is own index property of the Object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
// default [[Configurable]] attribute value of "0": true // default [[Configurable]] attribute value of "0": true
var obj = { 0: 0, 1: 1, length: 2}; var obj = { 0: 0, 1: 1, length: 2};
Object.freeze(obj); Object.freeze(obj);
var desc = Object.getOwnPropertyDescriptor(obj, "0"); verifyNotWritable(obj, "0");
verifyNotConfigurable(obj, "0");
delete obj[0]; assert.sameValue(obj[0], 0);
return obj[0] === 0 && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -9,19 +9,14 @@ es5id: 15.2.3.9-2-a-14
description: > description: >
Object.freeze - 'P' is own index property of an Array object that Object.freeze - 'P' is own index property of an Array object that
uses Object's [[GetOwnProperty]] uses Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
// default [[Configurable]] attribute value of "0": true // default [[Configurable]] attribute value of "0": true
var arrObj = [0, 1, 2]; var arrObj = [0, 1, 2];
Object.freeze(arrObj); Object.freeze(arrObj);
var desc = Object.getOwnPropertyDescriptor(arrObj, "0"); verifyNotWritable(arrObj, "0");
verifyNotConfigurable(arrObj, "0");
delete arrObj[0]; assert.sameValue(arrObj[0], 0);
return arrObj[0] === 0 && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -9,10 +9,9 @@ es5id: 15.2.3.9-2-a-2
description: > description: >
Object.freeze - 'P' is own data property that overrides an Object.freeze - 'P' is own data property that overrides an
inherited data property inherited data property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var proto = { foo: 0 }; // default [[Configurable]] attribute value of foo: true var proto = { foo: 0 }; // default [[Configurable]] attribute value of foo: true
@ -25,9 +24,7 @@ function testcase() {
Object.freeze(child); Object.freeze(child);
var desc = Object.getOwnPropertyDescriptor(child, "foo"); verifyNotWritable(child, "foo");
verifyNotConfigurable(child, "foo");
delete child.foo; assert.sameValue(child.foo, 10);
return child.foo === 10 && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -9,10 +9,9 @@ es5id: 15.2.3.9-2-a-3
description: > description: >
Object.freeze - 'P' is own data property that overrides an Object.freeze - 'P' is own data property that overrides an
inherited accessor property inherited accessor property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "foo", { Object.defineProperty(proto, "foo", {
@ -33,9 +32,6 @@ function testcase() {
Object.freeze(child); Object.freeze(child);
var desc = Object.getOwnPropertyDescriptor(child, "foo"); verifyNotWritable(child, "foo");
verifyNotConfigurable(child, "foo");
delete child.foo; assert.sameValue(child.foo, 10);
return child.foo === 10 && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -7,10 +7,9 @@
/*--- /*---
es5id: 15.2.3.9-2-a-4 es5id: 15.2.3.9-2-a-4
description: Object.freeze - 'P' is own accessor property description: Object.freeze - 'P' is own accessor property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
Object.defineProperty(obj, "foo", { Object.defineProperty(obj, "foo", {
@ -22,9 +21,5 @@ function testcase() {
Object.freeze(obj); Object.freeze(obj);
var desc = Object.getOwnPropertyDescriptor(obj, "foo"); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);
delete obj.foo;
return obj.foo === 10 && desc.configurable === false;
}
runTestCase(testcase);

View File

@ -9,10 +9,9 @@ es5id: 15.2.3.9-2-a-5
description: > description: >
Object.freeze - 'P' is own accessor property that overrides an Object.freeze - 'P' is own accessor property that overrides an
inherited data property inherited data property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
@ -32,9 +31,5 @@ function testcase() {
Object.freeze(child); Object.freeze(child);
var desc = Object.getOwnPropertyDescriptor(child, "foo"); verifyNotConfigurable(child, "foo");
assert.sameValue(child.foo, 10);
delete child.foo;
return child.foo === 10 && desc.configurable === false;
}
runTestCase(testcase);

View File

@ -9,10 +9,9 @@ es5id: 15.2.3.9-2-a-6
description: > description: >
Object.freeze - 'P' is own accessor property that overrides an Object.freeze - 'P' is own accessor property that overrides an
inherited accessor property inherited accessor property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "foo", { Object.defineProperty(proto, "foo", {
@ -36,9 +35,5 @@ function testcase() {
Object.freeze(child); Object.freeze(child);
var desc = Object.getOwnPropertyDescriptor(child, "foo"); verifyNotConfigurable(child, "foo");
assert.sameValue(child.foo, 10);
delete child.foo;
return child.foo === 10 && desc.configurable === false;
}
runTestCase(testcase);

View File

@ -9,19 +9,15 @@ es5id: 15.2.3.9-2-a-7
description: > description: >
Object.freeze - 'P' is own named property of an Arguments object Object.freeze - 'P' is own named property of an Arguments object
that implements its own [[GetOwnProperty]] that implements its own [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var argObj = (function () { return arguments; }()); var argObj = (function () { return arguments; }());
argObj.foo = 10; // default [[Configurable]] attribute value of foo: true argObj.foo = 10; // default [[Configurable]] attribute value of foo: true
Object.freeze(argObj); Object.freeze(argObj);
var desc = Object.getOwnPropertyDescriptor(argObj, "foo"); verifyNotWritable(argObj, "foo");
verifyNotConfigurable(argObj, "foo");
delete argObj.foo; assert.sameValue(argObj.foo, 10);
return argObj.foo === 10 && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -9,19 +9,15 @@ es5id: 15.2.3.9-2-a-8
description: > description: >
Object.freeze - 'P' is own named property of the String object Object.freeze - 'P' is own named property of the String object
that implements its own [[GetOwnProperty]] that implements its own [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var strObj = new String("abc"); var strObj = new String("abc");
strObj.foo = 10; // default [[Configurable]] attribute value of foo: true strObj.foo = 10; // default [[Configurable]] attribute value of foo: true
Object.freeze(strObj); Object.freeze(strObj);
var desc = Object.getOwnPropertyDescriptor(strObj, "foo"); verifyNotWritable(strObj, "foo");
verifyNotConfigurable(strObj, "foo");
delete strObj.foo; assert.sameValue(strObj.foo, 10);
return strObj.foo === 10 && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -9,19 +9,16 @@ es5id: 15.2.3.9-2-a-9
description: > description: >
Object.freeze - 'P' is own property of the Function object that Object.freeze - 'P' is own property of the Function object that
uses Object's [[GetOwnProperty]] uses Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var funObj = function () { }; var funObj = function () { };
funObj.foo = 10; // default [[Configurable]] attribute value of foo: true funObj.foo = 10; // default [[Configurable]] attribute value of foo: true
Object.freeze(funObj); Object.freeze(funObj);
var desc = Object.getOwnPropertyDescriptor(funObj, "foo"); verifyNotWritable(funObj, "foo");
verifyNotConfigurable(funObj, "foo");
delete funObj.foo; assert.sameValue(funObj.foo, 10);
return funObj.foo === 10 && desc.configurable === false && desc.writable === false;
}
runTestCase(testcase);

View File

@ -10,19 +10,18 @@ description: >
Object.freeze - The [[Configurable]] attribute of own accessor Object.freeze - The [[Configurable]] attribute of own accessor
property of 'O' is set to false while other attributes are property of 'O' is set to false while other attributes are
unchanged unchanged
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
function get_func() { function get_func() {
return 10; return 10;
} }
var resultSetFun = false; var set_funcCalled = false;
function set_func() { function set_func() {
resultSetFun = true; set_funcCalled = true;
} }
Object.defineProperty(obj, "foo", { Object.defineProperty(obj, "foo", {
@ -33,24 +32,16 @@ function testcase() {
}); });
Object.freeze(obj); Object.freeze(obj);
var res1 = obj.hasOwnProperty("foo");
delete obj.foo;
var res2 = obj.hasOwnProperty("foo");
var resultConfigurable = (res1 && res2);
var resultGetFun = (obj.foo === 10); assert(obj.hasOwnProperty("foo"));
verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);
obj.foo = 12; obj.foo = 12;
assert(set_funcCalled);
var resultEnumerable = false; verifyEnumerable(obj, "foo");
for (var prop in obj) {
if (prop === "foo") {
resultEnumerable = true;
}
}
var desc = Object.getOwnPropertyDescriptor(obj, "foo"); var desc = Object.getOwnPropertyDescriptor(obj, "foo");
var result = resultConfigurable && resultEnumerable && resultGetFun && resultSetFun; assert.sameValue(desc.configurable, false);
return desc.configurable === false && result;
}
runTestCase(testcase);

View File

@ -7,15 +7,10 @@
/*--- /*---
es5id: 15.2.3.13-2-1 es5id: 15.2.3.13-2-1
description: Object.isExtensible returns true for all built-in objects (Global) description: Object.isExtensible returns true for all built-in objects (Global)
includes: [runTestCase.js] includes: [fnGlobalObject.js]
---*/ ---*/
var global = this; var global = fnGlobalObject();
function testcase() {
// in non-strict mode, 'this' is bound to the global object. assert(Object.isExtensible(global));
var e = Object.isExtensible(this);
if (e === true) {
return true;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,7 @@
/*--- /*---
es5id: 15.2.3.12-3-1 es5id: 15.2.3.12-3-1
description: Object.isFrozen returns false for all built-in objects (Global) description: Object.isFrozen returns false for all built-in objects (Global)
includes: [runTestCase.js] includes: [fnGlobalObject.js]
---*/ ---*/
function testcase() { assert(!Object.isFrozen(fnGlobalObject()));
// in non-strict mode, 'this' is bound to the global object.
var b = Object.isFrozen(this);
if (b === false) {
return true;
}
}
runTestCase(testcase);

View File

@ -7,14 +7,7 @@
/*--- /*---
es5id: 15.2.3.11-4-1 es5id: 15.2.3.11-4-1
description: Object.isSealed returns false for all built-in objects (Global) description: Object.isSealed returns false for all built-in objects (Global)
includes: [runTestCase.js] includes: [fnGlobalObject.js]
---*/ ---*/
function testcase() { assert(!Object.isSealed(fnGlobalObject()));
// in non-strict mode, 'this' is bound to the global object.
var b = Object.isSealed(this);
if (b === false) {
return true;
}
}
runTestCase(testcase);

View File

@ -9,15 +9,16 @@ es5id: 15.2.3.10-3-10
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
an Error object an Error object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var errObj = new Error(); var errObj = new Error();
var preCheck = Object.isExtensible(errObj);
Object.preventExtensions(errObj);
errObj[0] = 12; assert(Object.isExtensible(errObj));
return preCheck && !errObj.hasOwnProperty("0"); Object.preventExtensions(errObj);
} assert(!Object.isExtensible(errObj));
runTestCase(testcase);
verifyNotWritable(errObj, "0", "nocheck");
assert(!errObj.hasOwnProperty("0"));

View File

@ -9,18 +9,18 @@ es5id: 15.2.3.10-3-11
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
an Arguments object an Arguments object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var argObj; var argObj;
(function () { (function () {
argObj = arguments; argObj = arguments;
}()); }());
var preCheck = Object.isExtensible(argObj);
Object.preventExtensions(argObj);
argObj[0] = 12; assert(Object.isExtensible(argObj));
return preCheck && !argObj.hasOwnProperty("0"); Object.preventExtensions(argObj);
} assert(!Object.isExtensible(argObj));
runTestCase(testcase);
verifyNotWritable(argObj, "0", "nocheck");
assert(!argObj.hasOwnProperty("0"));

View File

@ -9,15 +9,16 @@ es5id: 15.2.3.10-3-12
description: > description: >
Object.preventExtensions - named properties cannot be added into Object.preventExtensions - named properties cannot be added into
the returned object the returned object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
var preCheck = Object.isExtensible(obj);
Object.preventExtensions(obj);
obj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !Object.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-13
description: > description: >
Object.preventExtensions - named properties cannot be added into a Object.preventExtensions - named properties cannot be added into a
Function object Function object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = function () { };
var funObj = function () { };
var preCheck = Object.isExtensible(funObj);
Object.preventExtensions(funObj);
funObj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !funObj.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-14
description: > description: >
Object.preventExtensions - named properties cannot be added into Object.preventExtensions - named properties cannot be added into
an Array object an Array object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = [];
var arrObj = [];
var preCheck = Object.isExtensible(arrObj);
Object.preventExtensions(arrObj);
arrObj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !arrObj.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-15
description: > description: >
Object.preventExtensions - named properties cannot be added into a Object.preventExtensions - named properties cannot be added into a
String object String object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new String("bbq");
var strObj = new String("bbq");
var preCheck = Object.isExtensible(strObj);
Object.preventExtensions(strObj);
strObj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !strObj.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-16
description: > description: >
Object.preventExtensions - named properties cannot be added into a Object.preventExtensions - named properties cannot be added into a
Boolean object Boolean object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Boolean(true);
var boolObj = new Boolean(true);
var preCheck = Object.isExtensible(boolObj);
Object.preventExtensions(boolObj);
boolObj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !boolObj.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-17
description: > description: >
Object.preventExtensions - named properties cannot be added into a Object.preventExtensions - named properties cannot be added into a
Number object Number object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Number(123);
var numObj = new Number(123);
var preCheck = Object.isExtensible(numObj);
Object.preventExtensions(numObj);
numObj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !numObj.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-18
description: > description: >
Object.preventExtensions - named properties cannot be added into a Object.preventExtensions - named properties cannot be added into a
Date object Date object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Date();
var dateObj = new Date();
var preCheck = Object.isExtensible(dateObj);
Object.preventExtensions(dateObj);
dateObj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !dateObj.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-19
description: > description: >
Object.preventExtensions - named properties cannot be added into a Object.preventExtensions - named properties cannot be added into a
RegExp object RegExp object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new RegExp();
var regObj = new RegExp();
var preCheck = Object.isExtensible(regObj);
Object.preventExtensions(regObj);
regObj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !regObj.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,16 +9,15 @@ es5id: 15.2.3.10-3-2
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
the returned object the returned object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
var preCheck = Object.isExtensible(obj);
Object.preventExtensions(obj);
obj[0] = 12; assert(Object.isExtensible(obj));
return preCheck && !obj.hasOwnProperty("0"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "0", "nocheck");
assert(!obj.hasOwnProperty("0"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-20
description: > description: >
Object.preventExtensions - named properties cannot be added into Object.preventExtensions - named properties cannot be added into
an Error object an Error object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Error();
var errObj = new Error();
var preCheck = Object.isExtensible(errObj);
Object.preventExtensions(errObj);
errObj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !errObj.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,18 +9,18 @@ es5id: 15.2.3.10-3-21
description: > description: >
Object.preventExtensions - named properties cannot be added into Object.preventExtensions - named properties cannot be added into
an Arguments object an Arguments object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj;
var argObj;
(function () { (function () {
argObj = arguments; obj = arguments;
}()); }());
var preCheck = Object.isExtensible(argObj);
Object.preventExtensions(argObj);
argObj.exName = 2; assert(Object.isExtensible(obj));
return preCheck && !argObj.hasOwnProperty("exName"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "exName", "nocheck");
assert(!obj.hasOwnProperty("exName"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-3
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
a Function object a Function object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = function () { };
var funObj = function () { };
var preCheck = Object.isExtensible(funObj);
Object.preventExtensions(funObj);
funObj[0] = 12; assert(Object.isExtensible(obj));
return preCheck && !funObj.hasOwnProperty("0"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "0", "nocheck");
assert(!obj.hasOwnProperty("0"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-4
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
an Array object an Array object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = [];
var arrObj = [];
var preCheck = Object.isExtensible(arrObj);
Object.preventExtensions(arrObj);
arrObj[0] = 12; assert(Object.isExtensible(obj));
return preCheck && !arrObj.hasOwnProperty("0"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "0", "nocheck");
assert(!obj.hasOwnProperty("0"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-5-1
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
a String object a String object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new String("bbq");
var strObj = new String("bbq");
var preCheck = Object.isExtensible(strObj);
Object.preventExtensions(strObj);
strObj[10] = 12; assert(Object.isExtensible(obj));
return preCheck && !strObj.hasOwnProperty("10"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "10", "nocheck");
assert(!obj.hasOwnProperty("10"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-6
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
a Boolean object a Boolean object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Boolean(true);
var boolObj = new Boolean(true);
var preCheck = Object.isExtensible(boolObj);
Object.preventExtensions(boolObj);
boolObj[0] = 12; assert(Object.isExtensible(obj));
return preCheck && !boolObj.hasOwnProperty("0"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "0", "nocheck");
assert(!obj.hasOwnProperty("0"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-7
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
a Number object a Number object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Number(123);
var numObj = new Number(123);
var preCheck = Object.isExtensible(numObj);
Object.preventExtensions(numObj);
numObj[0] = 12; assert(Object.isExtensible(obj));
return preCheck && !numObj.hasOwnProperty("0"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "0", "nocheck");
assert(!obj.hasOwnProperty("0"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-8
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
a Date object a Date object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Date();
var dateObj = new Date();
var preCheck = Object.isExtensible(dateObj);
Object.preventExtensions(dateObj);
dateObj[0] = 12; assert(Object.isExtensible(obj));
return preCheck && !dateObj.hasOwnProperty("0"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "0", "nocheck");
assert(!obj.hasOwnProperty("0"));

View File

@ -9,15 +9,15 @@ es5id: 15.2.3.10-3-9
description: > description: >
Object.preventExtensions - indexed properties cannot be added into Object.preventExtensions - indexed properties cannot be added into
a RegExp object a RegExp object
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new RegExp();
var regObj = new RegExp();
var preCheck = Object.isExtensible(regObj);
Object.preventExtensions(regObj);
regObj[0] = 12; assert(Object.isExtensible(obj));
return preCheck && !regObj.hasOwnProperty("0"); Object.preventExtensions(obj);
} assert(!Object.isExtensible(obj));
runTestCase(testcase);
verifyNotWritable(obj, "0", "nocheck");
assert(!obj.hasOwnProperty("0"));

View File

@ -7,10 +7,9 @@
/*--- /*---
es5id: 15.2.3.8-2-4 es5id: 15.2.3.8-2-4
description: Object.seal - non-enumerable own property of 'O' is sealed description: Object.seal - non-enumerable own property of 'O' is sealed
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
Object.defineProperty(obj, "foo", { Object.defineProperty(obj, "foo", {
@ -18,13 +17,10 @@ function testcase() {
enumerable: false, enumerable: false,
configurable: true configurable: true
}); });
var preCheck = Object.isExtensible(obj);
assert(Object.isExtensible(obj));
Object.seal(obj); Object.seal(obj);
var beforeDeleted = obj.hasOwnProperty("foo"); assert(obj.hasOwnProperty("foo"));
delete obj.foo; verifyNotConfigurable(obj, "foo");
var afterDeleted = obj.hasOwnProperty("foo");
return preCheck && beforeDeleted && afterDeleted;
}
runTestCase(testcase);

View File

@ -7,17 +7,15 @@
/*--- /*---
es5id: 15.2.3.8-2-a-1 es5id: 15.2.3.8-2-a-1
description: Object.seal - 'P' is own data property description: Object.seal - 'P' is own data property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
obj.foo = 10; // default [[Configurable]] attribute value of foo: true obj.foo = 10; // default [[Configurable]] attribute value of foo: true
var preCheck = Object.isExtensible(obj);
assert(Object.isExtensible(obj));
Object.seal(obj); Object.seal(obj);
delete obj.foo; verifyNotConfigurable(obj, "foo");
return preCheck && obj.foo === 10; assert.sameValue(obj.foo, 10);
}
runTestCase(testcase);

View File

@ -9,17 +9,15 @@ es5id: 15.2.3.8-2-a-10
description: > description: >
Object.seal - 'P' is own property of a Boolean object that uses Object.seal - 'P' is own property of a Boolean object that uses
Object's [[GetOwnProperty]] Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Boolean(false);
var boolObj = new Boolean(false);
boolObj.foo = 10; obj.foo = 10;
var preCheck = Object.isExtensible(boolObj);
Object.seal(boolObj);
delete boolObj.foo; assert(Object.isExtensible(obj));
return preCheck && boolObj.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,17 +9,15 @@ es5id: 15.2.3.8-2-a-11
description: > description: >
Object.seal - 'P' is own property of a Number object that uses Object.seal - 'P' is own property of a Number object that uses
Object's [[GetOwnProperty]] Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Number(-1);
var numObj = new Number(-1);
numObj.foo = 10; obj.foo = 10;
var preCheck = Object.isExtensible(numObj);
Object.seal(numObj);
delete numObj.foo; assert(Object.isExtensible(obj));
return preCheck && numObj.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,17 +9,15 @@ es5id: 15.2.3.8-2-a-12
description: > description: >
Object.seal - 'P' is own property of a Date object that uses Object.seal - 'P' is own property of a Date object that uses
Object's [[GetOwnProperty]] Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Date();
var dateObj = new Date();
dateObj.foo = 10; obj.foo = 10;
var preCheck = Object.isExtensible(dateObj);
Object.seal(dateObj);
delete dateObj.foo; assert(Object.isExtensible(obj));
return preCheck && dateObj.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,17 +9,15 @@ es5id: 15.2.3.8-2-a-13
description: > description: >
Object.seal - 'P' is own property of a RegExp object that uses Object.seal - 'P' is own property of a RegExp object that uses
Object's [[GetOwnProperty]] Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new RegExp();
var regObj = new RegExp();
regObj.foo = 10; obj.foo = 10;
var preCheck = Object.isExtensible(regObj);
Object.seal(regObj);
delete regObj.foo; assert(Object.isExtensible(obj));
return preCheck && regObj.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,17 +9,15 @@ es5id: 15.2.3.8-2-a-14
description: > description: >
Object.seal - 'P' is own property of an Error object that uses Object.seal - 'P' is own property of an Error object that uses
Object's [[GetOwnProperty]] Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new Error();
var errObj = new Error();
errObj.foo = 10; obj.foo = 10;
var preCheck = Object.isExtensible(errObj);
Object.seal(errObj);
delete errObj.foo; assert(Object.isExtensible(obj));
return preCheck && errObj.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,17 +9,15 @@ es5id: 15.2.3.8-2-a-15
description: > description: >
Object.seal - 'P' is own property of an Arguments object which Object.seal - 'P' is own property of an Arguments object which
implements its own [[GetOwnProperty]] implements its own [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = (function () { return arguments; })();
var argObj = (function () { return arguments; })();
argObj.foo = 10; // default [[Configurable]] attribute value of foo: true obj.foo = 10;
var preCheck = Object.isExtensible(argObj);
Object.seal(argObj);
delete argObj.foo; assert(Object.isExtensible(obj));
return preCheck && argObj.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,24 +9,22 @@ es5id: 15.2.3.8-2-a-2
description: > description: >
Object.seal - 'P' is own data property that overrides an inherited Object.seal - 'P' is own data property that overrides an inherited
data property data property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var proto = { foo: 0 }; var proto = { foo: 0 };
var ConstructFun = function () { }; var ConstructFun = function () { };
ConstructFun.prototype = proto; ConstructFun.prototype = proto;
var child = new ConstructFun(); var obj = new ConstructFun();
Object.defineProperty(child, "foo", { Object.defineProperty(obj, "foo", {
value: 10, value: 10,
configurable: true configurable: true
}); });
var preCheck = Object.isExtensible(child);
Object.seal(child);
delete child.foo; assert(Object.isExtensible(obj));
return preCheck && child.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,10 +9,9 @@ es5id: 15.2.3.8-2-a-3
description: > description: >
Object.seal - 'P' is own data property that overrides an inherited Object.seal - 'P' is own data property that overrides an inherited
accessor property accessor property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "foo", { Object.defineProperty(proto, "foo", {
@ -25,15 +24,14 @@ function testcase() {
var ConstructFun = function () { }; var ConstructFun = function () { };
ConstructFun.prototype = proto; ConstructFun.prototype = proto;
var child = new ConstructFun(); var obj = new ConstructFun();
Object.defineProperty(child, "foo", { Object.defineProperty(obj, "foo", {
value: 10, value: 10,
configurable: true configurable: true
}); });
var preCheck = Object.isExtensible(child);
Object.seal(child);
delete child.foo; assert(Object.isExtensible(obj));
return preCheck && child.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -7,10 +7,9 @@
/*--- /*---
es5id: 15.2.3.8-2-a-4 es5id: 15.2.3.8-2-a-4
description: Object.seal - 'P' is own accessor property description: Object.seal - 'P' is own accessor property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var obj = {}; var obj = {};
Object.defineProperty(obj, "foo", { Object.defineProperty(obj, "foo", {
@ -19,10 +18,9 @@ function testcase() {
}, },
configurable: true configurable: true
}); });
var preCheck = Object.isExtensible(obj);
assert(Object.isExtensible(obj));
Object.seal(obj); Object.seal(obj);
delete obj.foo; verifyNotConfigurable(obj, "foo");
return preCheck && obj.foo === 10; assert.sameValue(obj.foo, 10);
}
runTestCase(testcase);

View File

@ -9,10 +9,9 @@ es5id: 15.2.3.8-2-a-5
description: > description: >
Object.seal - 'P' is own accessor property that overrides an Object.seal - 'P' is own accessor property that overrides an
inherited data property inherited data property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "foo", { Object.defineProperty(proto, "foo", {
@ -23,18 +22,17 @@ function testcase() {
var ConstructFun = function () { }; var ConstructFun = function () { };
ConstructFun.prototype = proto; ConstructFun.prototype = proto;
var child = new ConstructFun(); var obj = new ConstructFun();
Object.defineProperty(child, "foo", { Object.defineProperty(obj, "foo", {
get: function () { get: function () {
return 10; return 10;
}, },
configurable: true configurable: true
}); });
var preCheck = Object.isExtensible(child);
Object.seal(child);
delete child.foo; assert(Object.isExtensible(obj));
return preCheck && child.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,10 +9,9 @@ es5id: 15.2.3.8-2-a-6
description: > description: >
Object.seal - 'P' is own accessor property that overrides an Object.seal - 'P' is own accessor property that overrides an
inherited accessor property inherited accessor property
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() {
var proto = {}; var proto = {};
Object.defineProperty(proto, "foo", { Object.defineProperty(proto, "foo", {
@ -25,18 +24,17 @@ function testcase() {
var ConstructFun = function () { }; var ConstructFun = function () { };
ConstructFun.prototype = proto; ConstructFun.prototype = proto;
var child = new ConstructFun(); var obj = new ConstructFun();
Object.defineProperty(child, "foo", { Object.defineProperty(obj, "foo", {
get: function () { get: function () {
return 10; return 10;
}, },
configurable: true configurable: true
}); });
var preCheck = Object.isExtensible(child);
Object.seal(child);
delete child.foo; assert(Object.isExtensible(obj));
return preCheck && child.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,17 +9,15 @@ es5id: 15.2.3.8-2-a-7
description: > description: >
Object.seal - 'P' is own property of a Function object that uses Object.seal - 'P' is own property of a Function object that uses
Object's [[GetOwnProperty]] Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = function () { };
var funObj = function () { };
funObj.foo = 10; // default [[Configurable]] attribute value of foo: true obj.foo = 10;
var preCheck = Object.isExtensible(funObj);
Object.seal(funObj);
delete funObj.foo; assert(Object.isExtensible(obj));
return preCheck && funObj.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,17 +9,15 @@ es5id: 15.2.3.8-2-a-8
description: > description: >
Object.seal - 'P' is own property of an Array object that uses Object.seal - 'P' is own property of an Array object that uses
Object's [[GetOwnProperty]] Object's [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = [];
var arrObj = [];
arrObj.foo = 10; obj.foo = 10;
var preCheck = Object.isExtensible(arrObj);
Object.seal(arrObj);
delete arrObj.foo; assert(Object.isExtensible(obj));
return preCheck && arrObj.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);

View File

@ -9,17 +9,15 @@ es5id: 15.2.3.8-2-a-9
description: > description: >
Object.seal - 'P' is own property of a String object which Object.seal - 'P' is own property of a String object which
implements its own [[GetOwnProperty]] implements its own [[GetOwnProperty]]
includes: [runTestCase.js] includes: [propertyHelper.js]
---*/ ---*/
function testcase() { var obj = new String("abc");
var strObj = new String("abc");
strObj.foo = 10; // default [[Configurable]] attribute value of foo: true obj.foo = 10;
var preCheck = Object.isExtensible(strObj);
Object.seal(strObj);
delete strObj.foo; assert(Object.isExtensible(obj));
return preCheck && strObj.foo === 10; Object.seal(obj);
}
runTestCase(testcase); verifyNotConfigurable(obj, "foo");
assert.sameValue(obj.foo, 10);